从 C# 调用 .docm 宏
Call .docm macro from C#
如何在 C# 中调用 .docm 文件中的宏?
答案直接在下面
但是为了满足高质量的 Whosebug 标准,我必须在这里写一篇评论才能发布这个问题。
using System.IO;
using Microsoft.Office.Interop.Word;
namespace OpenDocmMacro
{
class Program
{
static void Main(string[] args)
{
string file_path = "";
string macro_name = "";
Application ap = new Application();
Document document = new Document();
try
{
document = ap.Documents.Open(Path.GetFullPath(file_path));
ap.Run(macro_name);
}
catch
{
}
finally
{
document.Close();
ap.Quit();
}
}
}
}
如何在 C# 中调用 .docm 文件中的宏?
答案直接在下面
但是为了满足高质量的 Whosebug 标准,我必须在这里写一篇评论才能发布这个问题。
using System.IO;
using Microsoft.Office.Interop.Word;
namespace OpenDocmMacro
{
class Program
{
static void Main(string[] args)
{
string file_path = "";
string macro_name = "";
Application ap = new Application();
Document document = new Document();
try
{
document = ap.Documents.Open(Path.GetFullPath(file_path));
ap.Run(macro_name);
}
catch
{
}
finally
{
document.Close();
ap.Quit();
}
}
}
}