Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: 1261 OLE Exception
I'm getting the 1261 OLE Exception error, in a OLE script that use to work just fine. We have just recently upgraded to WinBatch+Compiler 98E. Have you made any changes to OLE support? Here is my script:
MyXLObj = ObjectOpen("Excel.Application") MyXLObj.Visible = @TRUE MyWorkbooks = MyXLObj.Workbooks MyWorkbooks.open("C:\My Documents\FLDREFO2.xls") MyCell = MyXLObj.ActiveCell ValHold = MyCell.Value Message("Excel Test",ValHold)
I am getting the Error on the line:
MyWorkbooks.open("C:\My Documents\FLDREFO2.xls")
We have been working on adding better OLE support in current versions of WinBatch. Many times additional OLE error information is written out the th wwwbatch.ini file that resides in the windowd directory.
However lets take a real close look at your script. The code itself does seem valid. However, you may be getting this error because the file specified in the filepath my not exist or is open in read deny mode.
Try the following code that does some file existence checking.....
;debug(1) fex=FileExist("C:\My Documents\FLDREFO2.xls") if fex==@TRUE MyXLObj = ObjectOpen("Excel.Application") MyXLObj.Visible = @TRUE MyWorkbooks = MyXLObj.Workbooks MyWorkbooks.open("C:\My Documents\FLDREFO2.xls") MyCell = MyXLObj.ActiveCell ValHold = MyCell.Value Message("Excel Test",ValHold) else if fex==2;;;Opps file is open by another app in read deny mode message("Oops","File open by another app (possibly EXCEL), Try closing any open apps with this file") exit endif Message("Oops","File Path problem") endif exit
If the ASCII file that I'm importing has a problem and the import fails. The weird thing is that I am able to get the error that contains reason for the failure in other languages (ie bad product code, missing customer code, etc...) but with WinBatch all I get is an exception error and that's it.
oPtLogin = ObjectCreate("PeachtreeAccounting.Login.13") ;Specificly launches Peachtree 2006 oPTApp = oPTLogin.GetApplication("Sales Automation Services Inc", "password") oPTConst = ObjectConstantsGet(oPTLogin) oPTImport = oPTApp.CreateImporter(oPTConst.peachwIEObjSalesJournal) ; 5 - Sales Journal oPTImport.ClearImportFieldList oPTImport.AddToImportFieldList(oPTConst.peachwIEObjSalesJournalField_CustomerID) ;0 - Customer ID oPTImport.AddToImportFieldList(oPTConst.peachwIEObjSalesJournalField_InvoiceNumber) ;2 - Invoice Number oPTImport.AddToImportFieldList(oPTConst.peachwIEObjSalesJournalField_IsCreditMemo) ;60 - Is Credit Memo oPTImport.AddToImportFieldList(oPTConst.peachwIEObjSalesJournalField_Date) ;3 - Date oPTImport.AddToImportFieldList(oPTConst.peachwIEObjSalesJournalField_ShipToName) ;8 - Ship to Name oPTImport.AddToImportFieldList(oPTConst.peachwIEObjSalesJournalField_ShipToAddressLine1) ;9 - Ship To Addr1 oPTImport.AddToImportFieldList(oPTConst.peachwIEObjSalesJournalField_ShipToAddressLine2) ;10 - Ship to Addr2 oPTImport.AddToImportFieldList(oPTConst.peachwIEObjSalesJournalField_ShipToCity) ;11 - Ship to City oPTImport.AddToImportFieldList(oPTConst.peachwIEObjSalesJournalField_ShipToState) ;12 - Ship to State oPTImport.AddToImportFieldList(oPTConst.peachwIEObjSalesJournalField_ShipToZip) ;13 - Ship to Zip oPTImport.AddToImportFieldList(oPTConst.peachwIEObjSalesJournalField_ShipToCountry) ;14 - Ship to Country oPTImport.AddToImportFieldList(oPTConst.peachwIEObjSalesJournalField_ShipVia) ;16 - ShipVia oPTImport.AddToImportFieldList(oPTConst.peachwIEObjSalesJournalField_ARAccountID) ;23 - A/R Account oPTImport.AddToImportFieldList(oPTConst.peachwIEObjSalesJournalField_TaxType) ;25 - Sales Tax Code oPTImport.AddToImportFieldList(oPTConst.peachwIEObjSalesJournalField_NumberOfDistributions) ;32 - Number of Distributions oPTImport.AddToImportFieldList(oPTConst.peachwIEObjSalesJournalField_Quantity) ;36 - Quantity oPTImport.AddToImportFieldList(oPTConst.peachwIEObjSalesJournalField_ItemID) ;37 - Item ID oPTImport.AddToImportFieldList(oPTConst.peachwIEObjSalesJournalField_Description) ;38 - Description oPTImport.AddToImportFieldList(oPTConst.peachwIEObjSalesJournalField_GLAccountID) ;39 - G/L Sales Account oPTImport.AddToImportFieldList(oPTConst.peachwIEObjSalesJournalField_UnitPrice) ;40 - Unit Price oPTImport.AddToImportFieldList(oPTConst.peachwIEObjSalesJournalField_TaxType) ;41 - Tax Type oPTImport.AddToImportFieldList(oPTConst.peachwIEObjSalesJournalField_Amount) ;42 - Amount oPTImport.AddToImportFieldList(oPTConst.peachwIEObjSalesJournalField_SalesTaxAuthority) ;47 - Sales Tax Authority oPTImport.SetFileIncludesHeadersFlag(@FALSE) oPTImport.SetWarnBeforeImportingDuplicates(@FALSE) oPTImport.SetFileType(oPTConst.peachwIEFileTypeCSV) oPTImport.SetFileName(cInvFileName) oPTImport.Import() ;Error Occurs here. oPTImport = ""
I spoke to the developers this morning regarding the issue you are having. The developers claimed that iDispatch Invoke permits different ways for us to retrieve error information. They have apparently implemented every method except one. The method they have chosen not to incorporate is a Microsoft method.
Apparently this method queries system errors using the OS. However, our developers have determined this method as potentially flawed. They found that many times this method, would return invalid error information. They figured rather than returning possible invalid information, they were better off returning nothing at all, other than an generic 1261 error.
For now you are be limited to just capturing the 1261 error. The developers stated however, that they will be looking into adding the MS method for OLE error capturing.
Article ID: W13658
Filename: 1261 Ole Exception error.txt
File Created: 2006:11:08:10:08:38
Last Updated: 2006:11:08:10:08:38