+ Reply to Thread
Results 1 to 6 of 6

Save workbook as HTML

  1. #1
    Registered User
    Join Date
    07-23-2009
    Location
    Providence
    MS-Off Ver
    Excel 2003
    Posts
    5

    Save workbook as HTML

    Hi,

    i have an excel workbook open and i need to create a macro that will save the workbook as an html file, but leave the original file the same.

    i know there is a SaveCopyAs function, but i can only get that to work with saving as an .xls file.

    Does anyone know if the SaveCopyAs has the ability to save the current workbook as an HTML file without changing what's in memory?

    thanks
    Scott

  2. #2
    Valued Forum Contributor SDruley's Avatar
    Join Date
    04-27-2009
    Location
    Conover, NC
    MS-Off Ver
    Excel 2010 64 bit
    Posts
    415

    Re: Save workbook as HTML

    Try this:

    ActiveWorkbook.SaveAs Filename:= _
    "C:\Users\Scott\Documents\Book2.htm", FileFormat:=xlHtml, _ ReadOnlyRecommended:=False,CreateBackup:=False

  3. #3
    Registered User
    Join Date
    07-23-2009
    Location
    Providence
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Save workbook as HTML

    that does save the file correctly, however, it updates the excel file that is open to that file name. I don't want the current file name to change, just to be saved as html somewhere else.

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Save workbook as HTML

    saving "as" doesnt change the file, you will still have the original and a new one as .htm
    (the htm is in the window
    the xl one has just closed without saving)
    if you reopen excel file it will be in its last saved state (before you saved as htm)
    Last edited by martindwilson; 07-28-2009 at 04:37 PM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  5. #5
    Registered User
    Join Date
    07-23-2009
    Location
    Providence
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Save workbook as HTML

    you are correct, but i was trying to keep the original file open, but not sure if it's possible.

  6. #6
    Valued Forum Contributor SDruley's Avatar
    Join Date
    04-27-2009
    Location
    Conover, NC
    MS-Off Ver
    Excel 2010 64 bit
    Posts
    415

    Re: Save workbook as HTML

    Programmatically reopen the closed file and close the HTML version

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1