I am attempting to write a Sage BOI VBS program to read and write to the SO Shipping Data Entry Package Tracking By Item object and am receiving the error <NewObject Error: 200>. I am using a Sage user that has full access to Sage and have the company ABC set to Allow External Access. Any help would be appreciated. Code is below:
‘------------------------------------------------------------------------
Option Explicit
Dim objIE
Dim objShell
Dim oConnection
Dim oExec
Dim oFile
Dim oFSO
Dim oRecordSet
Dim oScript
Dim oSec
Dim oSS
Dim r
Dim o
Dim pInvoiceNo
'Create ProvideX COM Object
Set oScript = CreateObject ("ProvideX.Script")
'The Init method must be the first method called
' Please remember to correct the MAS90\Home path
oScript.Init("C:\Sage\Sage 100 Standard\MAS90\Home")
'The Session object must be the first MAS 90 object created
Set oSS = oScript.NewObject("SY_Session")
' Set the user for the Session
r = oSS.nLogon()
If r=0 Then
' Please remember to correct the username, password
r = oss.nSetUser("user","password") ' I am using a FULL ACCESS Sage user and password.
End If
' Set the company, module date and module for the Session
r = oss.nsetcompany("ABC")
r = oSS.nSetDate("S/O","20240321")
r = oSS.nSetModule("S/O")
' Instantiate business object
oSEC = oSS.nSetProgram(oSS.nLookupTask("SO_PackageTrackingByItem_Ui"))
Set o = oScript.NewObject("SO_PackageTrackingByItem_bus", oSS, "SO_PackageTrackingByItem")
r = o.nMoveFirst()
r = o.nGetValue("InvoiceNo$", "pInvoiceNo")
msgbox pInvoiceNo
r = o.DropObject()
Wscript.Echo "DONE"
Wscript.Quit