我在 Outlook 中有一个宏,我让它打开一个保存在我桌面上的 Excel 文件。打开文件后,我想运行一个我用 excel 编写的宏,但我的 excel 宏都不可用。每当我以任何其他方式打开 excel 时,这些宏都可用,并且当我通过 Outlook vba 打开 excel 时启用宏。我的问题是,当我通过 Outlook 宏打开 Excel 时,如何使这些宏可用?请在下面参考我的代码。
'Pre:None
'Post:Excel will have been opened, and the macro "CreatePowerPoint()"
' will have been run on the excel document
Sub Gimba()
Dim xlApp As Object, xlWkb As Object
'open excel
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True ' can be False if you do not wont see reaction,
' byt make sure is not fail
'Do not show any alerts
xlApp.DisplayAlerts = False
'open excel document
Set xlWkb = xlApp.Workbooks.Open(file path goes here)
'call macro on excel document
Call xlApp.Run("CreatePowerPoint")
End Sub