I have a CSV file that I receive daily that I format using a macro that is stored in my personal macro file. I am trying to create a vbs file that will run the macro on the CSV file via a scheduled task, but I am not having an luck. Here is the vbs file:
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
This is the error that I am getting:
C:\Users\dmcgettigan\Desktop\test.vbs(13, 3) Microsoft Excel: Cannot run the macro 'c:\users\dmcgettigan\desktop\Personal.xlsb!new sales'. The macro may not be available in this workbook or all macros may be disabled.
Any ideas on what I am doing wrong?