Let me apologize for my unfamiliarity with Access terms/concepts in advance.
ItsMe,
I looked around messageboards for a while and tested some .BAT files. I got this one to work:
Code:
"C:\Program Files (x86)\Microsoft Office\Office15\MSACCESS.EXE" "C:\Users\mmickle\Desktop\Managed_Care_Database.accdb"
In another messageboard post it referenced calling a macro like this: /x TestRun (so this could indeed be wrong)
How should I go about this?
pbaldy,
I changed the code to this:
It is in a regular code module named "MacroTest"
Code:
Function TestRun()
Dim xls As Excel.Application
Dim wkb As Excel.Workbook
Dim wks As Excel.Worksheet
Set xls = New Excel.Application
Set wkb = xls.Workbooks.Add
Set wks = wkb.Worksheets(1)
wks.Name = "My New Name"
ActiveWorkbook.SaveAs "C:\Users\mmickle\Desktop\WeAreInBusiness.xlsx"
wkb.Close True
Set wks = Nothing
Set wkb = Nothing
xls.Quit
Set xls = Nothing
End Function
Then I created a Macro using the Access UI named "Test1"
Action: RunCode
Function Name: TestRun
When I tried to use this as a function it added an open parenthesis like this: "TestRun(" How/ Do I need to re-write the function?
How would I call the Macro Test1 from Task Scheduler?
Thanks for the assistance. I am fairly new to any MS Access Code/Macros. I only have experience with Excel VBA
EDIT:
I changed the Function Name: to TestRun()
When I click the "Test1" Macro in Access it works. A new Workbook appears on my desktop. However when I try using the .BAT file
Code:
"C:\Program Files (x86)\Microsoft Office\Office15\MSACCESS.EXE" "C:\Users\mmickle\Desktop\Managed_Care_Database.accdb" /x Test1
No Dice. It opens MS Access but doesn't trigger the Macro.