This is my first time using VBs. I used to it to automate Excel macro but I failed due to the spacing between filenames. It works fine if the space was removed. I read this post and used the double quote method but did not work.
This is how I used it objExcel.Application.Run "'"C:\Users\account\Desktop\test Folder\vbsExcel.xlsm"'!test.getValue"
but getting
expected end of statement
as error.I think I used it the wrong way.
Example path
objExcel.Application.Run "'C:\Users\account\Desktop\test Folder\vbsExcel.xlsm'!test.getValue"
Path that work - remove space in folder name
objExcel.Application.Run "'"C:\Users\account\Desktop\testFolder\vbsExcel.xlsm"'!test.getValue"
Tried
objExcel.Application.Run "'C:\Users\account\Desktop\test" + " " + "Folder\vbsExcel.xlsm'!test.getValue"
For what I tried, it partially works because the vbs
does run the macro. However, the Excel file is being opened and only works when macro is being enabled. (same thing happens if run using Example Path)
My ultimate goal is to run macro in the Excel without opening the excel file using the Example Path. (simply means allowing space in filenames)
Full Script
Set objExcel = CreateObject("Excel.Application")
objExcel.Application.Run "'C:\Users\account\Desktop\testFolder\vbsExcel.xlsm'!test.getValue"
objExcel.DisplayAlerts = False
objExcel.Application.Quit
Set objExcel = Nothing