colham1956
Programmer
I need to use an Accpac V5.5 macro to import GL transactions into a GL batch. I have compiled the following macro code but it does not work. The XML script reference in the macro code is correct as I can use the Accpac GL Import/Export function to load the XML script and perform the import that way. I have the Accpac Import/Export 1.0 reference turned on for the macro. I am using similar macros to successfully import Account Codes, Account Segments, and Budgets but the GL transactions version (so far) won't work. All responses appreciated!
Sub MainSub()
Dim ReturnValue As Boolean
Dim mDBLinkCmpRW As AccpacCOMAPI.AccpacDBLink
Set mDBLinkCmpRW = OpenDBLink(DBLINK_COMPANY, DBLINK_FLG_READWRITE)
Dim mDBLinkSysRW As AccpacCOMAPI.AccpacDBLink
Set mDBLinkSysRW = OpenDBLink(DBLINK_SYSTEM, DBLINK_FLG_READWRITE)
Dim MyImport As AccpacImportExport.ImportExport
Set MyImport = New AccpacImportExport.ImportExport
MyImport.Open mDBLinkCmpRW
MyImport.ImportAction = IMPORT_INSERT_AND_UPDATE
MyImport.SetView "GL0008", "", VIEW_FLAT, Null
MyImport.SetView "GL0006", "", VIEW_FLAT, Null
MyImport.SetView "GL0010", "", VIEW_FLAT, Null
MyImport.SetView "GL0402", "", VIEW_FLAT, Null
MyImport.ExecuteImportScript "C:\Temp\GENLEDTRA.xml", ReturnValue
MyImport.Close
End Sub
Sub MainSub()
Dim ReturnValue As Boolean
Dim mDBLinkCmpRW As AccpacCOMAPI.AccpacDBLink
Set mDBLinkCmpRW = OpenDBLink(DBLINK_COMPANY, DBLINK_FLG_READWRITE)
Dim mDBLinkSysRW As AccpacCOMAPI.AccpacDBLink
Set mDBLinkSysRW = OpenDBLink(DBLINK_SYSTEM, DBLINK_FLG_READWRITE)
Dim MyImport As AccpacImportExport.ImportExport
Set MyImport = New AccpacImportExport.ImportExport
MyImport.Open mDBLinkCmpRW
MyImport.ImportAction = IMPORT_INSERT_AND_UPDATE
MyImport.SetView "GL0008", "", VIEW_FLAT, Null
MyImport.SetView "GL0006", "", VIEW_FLAT, Null
MyImport.SetView "GL0010", "", VIEW_FLAT, Null
MyImport.SetView "GL0402", "", VIEW_FLAT, Null
MyImport.ExecuteImportScript "C:\Temp\GENLEDTRA.xml", ReturnValue
MyImport.Close
End Sub