Results 1 to 8 of 8

Thread: [RESOLVED] Convert excel to html with PublishObjects

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2008
    Posts
    4

    Resolved [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

  2. #2
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    Re: Convert excel to html with PublishObjects

    Welcome to the Forums


    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 ?



    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

    IIF(Post.Rate > 0 , , )

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Convert excel to html with PublishObjects

    Welcome to the forums.
    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?

  4. #4

    Thread Starter
    New Member
    Join Date
    Apr 2008
    Posts
    4

    Smile Re: Convert excel to html with PublishObjects

    Quote Originally Posted by zeezee
    Welcome to the Forums


    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 ?



    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

    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....

  5. #5
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    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
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  6. #6

    Thread Starter
    New Member
    Join Date
    Apr 2008
    Posts
    4

    Re: Convert excel to html with PublishObjects

    Proble resolved....Tank you

  7. #7
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    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

    IIF(Post.Rate > 0 , , )

  8. #8

    Thread Starter
    New Member
    Join Date
    Apr 2008
    Posts
    4

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width