World!
I am trying to automate a report task at my job and I have the following situation:
I need to execute a macro on a workbook by using a script. I tried to write a vbscript to do the job, and this is the significant part of it:
Set objWbk = GetObject("***Path***\test.xlsm")
objWbk.Application.Run "test.xlsm!test"
WScript.Quit
The macro runs perfectly. My real problem is that I only want to do the report only if the workbook is open.
Is there a way (in vbs or vba) to determine if that workbook is open ? (by the way, it is located on another computer on my network)
Since you want to run the macro only when the workbook is already opened, something like this might work:
This is not fully tested and may a need a bit of modification but see if it gets you what you need.