[RESOLVED] Convert excel to html with PublishObjects
Hi… I would want to create a sub to export a sheet excel to HTML file. From excel I have recorded the macro while I made “file - saves as page web” and this is the code that has created:
With ActiveWorkbook.PublishObjects.Add(xlSourceSheet, "C:\Page.htm", _
"Report", "", xlHtmlStatic, "Report_28311", "")
.Publish (True)
.AutoRepublish = False
End With
I inserting this code on VB6, but does not work.
Someone can help me to arrange this partof code in order to make it to work in VB6?
Thanks
Re: Convert excel to html with PublishObjects
Welcome to the Forums
:wave:
Ever wondered why there is a Topic called Announcement: Before you post.... in the top of the Forum?
Or Ever wondered why there is a section for FAQ = Frequently Asked Questions ?
:confused:
OK, since you haven't got it , i ll give you the link ;)
http://www.vbforums.com/showthread.php?t=391665
http://www.vbforums.com/showpost.php...0&postcount=12
:wave:
Re: Convert excel to html with PublishObjects
Welcome to the forums. :wave:
Quote:
Originally Posted by mcgnai
I inserting this code on VB6, but does not work.
What does this mean? What happens when you run the code?
Re: Convert excel to html with PublishObjects
Quote:
Originally Posted by zeezee
I'am sorry but i haven't see the FAQ section, but i use the search section.
Thank you for give me the link...i view it, but i not found nothing for my question....:wave:
Re: Convert excel to html with PublishObjects
what code are you using in vb6 to work with excel?
you need to create an instance of excel, attach to the specific workbook you want to work with, then run the code to publish the specific sheet
avoid using references to active anything or selection
Re: Convert excel to html with PublishObjects
Proble resolved....Tank you
Re: [RESOLVED] Convert excel to html with PublishObjects
Glad you solved the problem. :)
And if you don't mind sharing your solution, please post that also.
It might help someone with the problem next time ;)
:wave:
Re: [RESOLVED] Convert excel to html with PublishObjects
path = App.Path
FileHtm = "\Report.htm"
Set wkb = Workbooks.Open(path + filexcel)
With ActiveWorkbook.PublishObjects.Add(xlSourceSheet, _
path_htm + FileHtm, "Riep", "" _
, xlHtmlStatic, "", "Report")
.Publish (True)
.AutoRepublish = False
End With