+ Reply to Thread
Results 1 to 2 of 2

Fixing a Macro-related Crash in Excel

  1. #1
    Registered User
    Join Date
    05-31-2005
    Posts
    6

    Fixing a Macro-related Crash in Excel

    Hello all! I’m running into some problems with a spreadsheet I’m making. I’m also fairly new to Excel, so I have no idea how to fix them. Now, the big goal right now is to get a spreadsheet I’ve made to save itself automatically as an HTML file whenever the worksheet is saved conventionally with ctrl+s or file->save, etc. I currently have the following code, the first in a module, the second in the ThisWorkbook file.

    Sub ExportAsHTML()

    Application.DisplayAlerts = False
    ActiveWorkbook.SaveAs Filename:= _
    "T:\Dan Youngren\System\EngineeringHealthGauges.htm" _
    , FileFormat:=xlHtml, ReadOnlyRecommended:=False, CreateBackup:=False
    Application.DisplayAlerts = True
    End Sub



    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

    Application.DisplayAlerts = False
    Call ExportAsHTML
    Application.DisplayAlerts = True

    End Sub


    Now, the problem is that whenever I save, the html exports just fine, but excel crashes and the changes to the .xls are lost. Does anyone know how to fix my code or just get it to do what I want in a different way?


    Also, I’ve also been wanting to put text in charts that changes based on changes to some sort of source cell in the worksheet. That is, I’d like titles and other text boxes to change when some cell in the worksheet does.

  2. #2
    Dave Peterson
    Guest

    Re: Fixing a Macro-related Crash in Excel

    See one guess at your other post.

    Danimagus wrote:
    >
    > Hello all! I’m running into some problems with a spreadsheet I’m making.
    > I’m also fairly new to Excel, so I have no idea how to fix them. Now,
    > the big goal right now is to get a spreadsheet I’ve made to save itself
    > automatically as an HTML file whenever the worksheet is saved
    > conventionally with ctrl+s or file->save, etc. I currently have the
    > following code, the first in a module, the second in the ThisWorkbook
    > file.
    >
    > Sub ExportAsHTML()
    >
    > Application.DisplayAlerts = False
    > ActiveWorkbook.SaveAs Filename:= _
    > "T:\Dan Youngren\System\EngineeringHealthGauges.htm" _
    > , FileFormat:=xlHtml, ReadOnlyRecommended:=False,
    > CreateBackup:=False
    > Application.DisplayAlerts = True
    > End Sub
    >
    > Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
    > Boolean)
    >
    > Application.DisplayAlerts = False
    > Call ExportAsHTML
    > Application.DisplayAlerts = True
    >
    > End Sub
    >
    > Now, the problem is that whenever I save, the html exports just fine,
    > but excel crashes and the changes to the .xls are lost. Does anyone
    > know how to fix my code or just get it to do what I want in a different
    > way?
    >
    > Also, I’ve also been wanting to put text in charts that changes based
    > on changes to some sort of source cell in the worksheet. That is, I’d
    > like titles and other text boxes to change when some cell in the
    > worksheet does.
    >
    > --
    > Danimagus
    > ------------------------------------------------------------------------
    > Danimagus's Profile: http://www.excelforum.com/member.php...o&userid=23894
    > View this thread: http://www.excelforum.com/showthread...hreadid=376798


    --

    Dave Peterson

+ 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