To create the VBA in Excel, Record an Excel macro, and just copy and paste it into Macro Scheduler,using my sample as a template. Then run that VBA inside Macro Scheduler. Do not save your Excel file as an .xlsm.
Looking at VBRunCode you'll see a usage example. You'll also see this :
For XLRunCode to work 'Trust Access to the VBA project object model' must be enabled in Excel:
In Excel go to File/Options -> Trust Center -> Trust Center Settings -> Macro Settings.
Under 'Developer Macro Settings' enable 'Trust Access to the VBA project object model'
Once you've enabled "trust access...", follow these Excel steps :
1. Click on the Developer Tab.
2. Click Record Macro.
3. Name your Macro, and click OK - ignore the Autosave "save as" message if you get one.
4. Record Your actions.
5. Click "Stop Recording".
6. Click "Macros".
7. Select your recently recorded macro, and click Edit.
8. Select all the VBA code, and copy it.
9. Paste that VBA into your Macro, excluding the first (sub) and last (end sub) lines.
10. Put them in a label and use them the same way I have in my example.
Hints, tips and tricks for newbies