I came across a blog post from 2013 that mentions that it is possible to run a sage macro without logging directly into sage using VBA, this could then be automated with task scheduler on windows
here is the original blogpost from greytrix:
The trouble I am experiencing is finding information about what my "Accpac" user id, password and company id are?
here is the code base for the VBA macro
<Code Snip>
Dim Signon
Dim SignonID
Dim strCommand
Dim AllProcess
Dim Process
Dim strFoundProcess
strFoundProcess = False
Set AllProcess = getobject(“winmgmts:”) ‘create object
For Each Process In AllProcess.InstancesOf(“Win32_process”) ‘Get all the processes running ‘in your PC
If (Instr (Ucase(Process.Name),”ACCPAC.EXE”) = 1) Then ‘Made all uppercase to ‘remove ambiguity. Replace TASKMGR.EXE with your application name in CAPS.
‘msgbox “Application is already running!” ‘You can replace this with ‘Reporter.ReportEvent
‘Change the macro name and path
strCommand = “A4WVBA.EXE -r -f “”E:\Program Files\Sage\Sage Accpac\OE60A\XXX.avb”””
Set wshShell = WScript.CreateObject (“WSCript.shell”)
wshshell.run strCommand, 6, True
set wshshell = nothing
‘Signon.SignoffSession SignonID
‘Set Signon = Nothing
strFoundProcess = True
Exit for
End If
Next
If strFoundProcess = False Then
‘msgbox “Go ahead!Application is not running” ‘You can replace this with ‘Reporter.ReportEvent
Set Signon = CreateObject(“A4wSignonMgr.AccpacSignonMgr”)
‘Change the Signon paramters to match the company login
‘SignonID = Signon.RegisterSignon(“USERID”, “PASSWORD”, “COMPANYID”, “Company Name”, Date)
‘USERID = Accpac user in upper case
‘PASSWORD = Accpac user password in upper case
‘COMPANYID = Accpac company ID in upper case
SignonID = Signon.RegisterSignon(“ADMIN”, “ADMIN”, “SAMINC”, “Sample Company”, Date)
‘Change the macro name and path
strCommand = “A4WVBA.EXE -r -f “”E:\Program Files\Sage\Sage Accpac\OE60A\XXX.avb”””
Set wshShell = WScript.CreateObject (“WSCript.shell”)
wshshell.run strCommand, 6, True
set wshshell = nothing
Signon.SignoffSession SignonID
Set Signon = Nothing
End If
Set AllProcess = nothing
</Code Snip>