发布网友 发布时间:2022-04-24 18:57
共2个回答
热心网友 时间:2022-06-18 20:16
Dim wrdApp As Object
Dim wrdDoc As Object
On Error GoTo myErr
Set wrdApp = GetObject(, "Word.Application") ‘有Word进程时
Set wrdDoc = wrdApp.Documents.Open("Word文件地址")
wrdApp.Visible = True '显示Word
wrdApp.Run "Word 宏名"
Set wrdDoc = Nothing
Set wrdApp = Nothing
Exit Sub
myErr:
Set wrdApp = CreateObject("Word.Application") ‘没有Word进程时
Set wrdDoc = wrdApp.Documents.Open("Word 文件地址")
wrdApp.Visible = True '显示Word
wrdApp.Run "Word 宏名"
Set wrdDoc = Nothing
Set wrdApp = Nothing
热心网友 时间:2022-06-18 20:17
excel中运行宏 我提供实例