【发布时间】:2018-10-02 11:24:40
【问题描述】:
我每天收到一个 CSV 文件,我使用存储在我的个人宏文件中的宏对其进行格式化。我正在尝试创建一个 vbs 文件,该文件将通过计划任务在 CSV 文件上运行宏,但我没有运气。这是vbs文件:
Option Explicit
ExcelMacroExample
Sub ExcelMacroExample()
Dim xlApp
Dim xlBook
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Open("c:\users\dmcgettigan\desktop\test.csv", 0, True)
xlApp.Run "c:\users\dmcgettigan\desktop\Personal.xlsb!newsales"
xlApp.Quit
Set xlBook = Nothing
Set xlApp = Nothing
End Sub
这是我得到的错误:
C:\Users\dmcgettigan\Desktop\test.vbs(13, 3) Microsoft Excel:无法运行宏 'c:\users\dmcgettigan\desktop\Personal.xlsb!new sales'。该工作簿中的宏可能不可用,或者所有宏都可能被禁用。
关于我做错了什么有什么想法吗?
【问题讨论】: