Hi everyone,
I’m trying to export a .htm file from Xojo using Excel application and VBA instructions that work fine in Office. But, I’m getting one error when I run the app. The example code is :
-------------------------------------------->
Dim xls As New ExcelApplication
dim n as Integer
dim sFile as String
'vars
sFile=“C:\Report.htm”
'Excel configuration
xls.Visible=True
xls.Workbooks.Add
xls.ActiveWorkbook.Sheets(1).Range(“A1”)=“Hello World”
xls.ActiveWorkbook.PublishObjects.Add(4,sFile,“Sheet1”, “A1”,“xlHtmlStatic”,“Book_Report”,“Report”)
xls.ActiveWorkbook.PublishObjects.Publish (True)
xls.ActiveWorkbook.PublishObjects.AutoRepublish = False
'final message
n=MsgBox( “Process completed successfully”,64)
-------------------------------------------->
The error is OLEException # -2147352567, specifically when I try with the line xls.ActiveWorkbook.PublishObjects.Add()
I have been checking the documentation of MS for these parameters, and certainly the VBA code in office work without problem.
Someone know what I’m passing bad for parameters in Xojo/RS …?
Your help and comments will be greatly appreciated.