I am using A4wSignonMgr.AccpacSignonMgr to run unattended macros but have run into a problem while now running for multiple companies.

SUGGESTED

It seems as though the problem would not exist if I could just start a clean session each time. I am using a simple script to initiate a Macro but it apparently does not end the session when done. Thanks for any help.

Bill Domke

  • 0
    Show your script.
    I suspect in your script you have a session and a signon object, you need to sign out and set session=nothing in the scripts.
  • 0 in reply to Ettienne Schwagele
    Hello Ettienne,
    The script is a mirror of your post some time ago. You will recognize it below. What I have added to temporarily avoid the session manager causing it to hang, is a resume on error. Kindly see below and advise your thoughts.
    --------------------------------------------------------------------------
    On Error resume next

    Dim Signon

    Dim SignonID

    Dim strCommand
    Dim strDate



    Set Signon = CreateObject("A4wSignonMgr.AccpacSignonMgr")

    ForceNewSignon = True
    strDate = Month(Now) & "/" & Day(Now) & "/" & Year(Now)

    '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", "ADIADMIN", "FAKINC", "Fashion Avenue Knits", strd)



    'Change the macro name and path

    strCommand = "A4WVBA.EXE -r -f ""D:\Apps\Sage300\Macros\testreceiving.avb"""



    Set wshShell = WScript.CreateObject ("WSCript.shell")

    wshshell.run strCommand, 6, True

    set wshshell = nothing



    Signon.SignoffSession SignonID



    Set Signon = Nothing
    ---------------------------------------------------------------------------------------------------

    Best regards,
    Bill Domke
  • 0 in reply to Bill Domke
    I use that same script in a multi company setup. Check the Windows taskbar if the Sage 300 session is closing.
    Also in your macro you need to explicitly kill everything you open before the macro terminates.
  • 0 in reply to Ettienne Schwagele
    Hello Ettienne,
    No, The session manager is not closing. I knew this was the source of my problem but do not know how to kill it within the script or Macro. I don't want to sound ignorant but how do I explicitly kill everything in the Macro? VB is certainly not a specialty of mine. Again, I appreciate any help.

    Bill Domke
  • 0 in reply to Bill Domke
    At the end of the macro you need to close all the views you opened, you do this with <view>.Close, where <view> is the name of each view you use.
    Also close the database link with <mdblink>.Close
    Then use Set <view>=Nothing , again for each view and Set <mdblink> = Nothing
    Basically anything you open needs to be closed and set to nothing at the end of the macro.
  • 0 in reply to Ettienne Schwagele
    SUGGESTED
    Hello Ettienne,
    The Macros I use create several views but this sounds easy enough. I will give it a shot. Thank you so much for the help. Have a great day!

    Bill Domke