+ Reply to Thread
Results 1 to 3 of 3

Save as HTML on close

  1. #1
    Registered User
    Join Date
    05-24-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    17

    Save as HTML on close

    Hi all,

    I currently have an issue where I've got an xlsm workbook macro running to refresh my workbook and then output the new workbook to an xlsx file with the following code.

    Sub CreateSkinnyMe()
    Dim x As Integer

    ActiveWorkbook.RefreshAll

    For x = 1 To ActiveWorkbook.Connections.Count
    ActiveWorkbook.Connections(1).Delete
    Next

    On Error Resume Next
    Application.DisplayAlerts = False
    Kill "c:\cerner\excel\" & Split(ActiveWorkbook.Name, ".")(0) & ".htm"
    ActiveWorkbook.SaveAs "c:\cerner\excel\" & Split(ActiveWorkbook.Name, ".")(0), xlWorkbookDefault
    Application.DisplayAlerts = True
    Application.Quit

    End Sub


    What I'd like to do is also output the file as HTML. I've tried adding another "ActiveWorkbook.SaveAs" line but keep getting a runtime error.

    I'm fairly new to this so any pointers are greatly appreciated.

    Thanks

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Save as HTML on close

    Please Login or Register  to view this content.
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    05-24-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Save as HTML on close

    Quote Originally Posted by patel45 View Post
    Please Login or Register  to view this content.
    Thanks 45, I was getting the sheet looping when creating the html page so I changed the code a little from ActiveSheet.Copy to ActiveWorkbook.copy and that resolved my issues.

    Thanks again, much appreciated.

+ 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