vbs script suddenly started "unknown runtime error" on running macro in excel - any ideas??

krista327

New Member
Joined
May 21, 2019
Messages
1
My script was running just fine up until about a week ago. Now it throws an error on the macro run statement.
The macro runs fine in the spreadsheet when run manually. We did run windows updates, and an antivirus update; but that should not have changed anything in this - right?
I'm running windows 10, and Excel 2010.

Here's my script:
Dim oExcel
Dim gfuncs
Dim oBook

'determine whether the folders exist for data source and output; create the year directory if it does not already exist.
'look for source file
sSourceFile = "\\... myspreadsheetwithAmacro.xlsm"
set objFSO = createobject("scripting.filesystemobject")
if objFSO.fileexists(sSourceFile) then

else
wscript.echo "cannot find source file" & sSourceFile
end if

'--Start Excel and run it invisibly
Set oExcel = CreateObject("Excel.Application")
'oExcel.Visible = false
oExcel.displayalerts=true

'--Note: The act of opening the workbook will cause the functions to update
oExcel.Workbooks.open sSourceFile
oExcel.application.visible = true
oExcel.application.Run ("macro1") <-- this is the "unknown runtime error" line
oexcel.activeworkbook.close
oExcel.displayalerts=true
oexcel.workbooks(ssourcefile).close
oExcel.Quit
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Forum statistics

Threads
1,214,585
Messages
6,120,397
Members
448,957
Latest member
Hat4Life

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top