+ Reply to Thread
Results 1 to 1 of 1

Help Please. How to save multiple html files (sounds easy but scenario causing confli

  1. #1
    Registered User
    Join Date
    03-09-2005
    Posts
    7

    Question Help Please. How to save multiple html files (sounds easy but scenario causing confli

    Hello Group!
    Here is my scenario. I use third party software to dump data (running every hr) into excel. The following code works fine as far as saving file as an html with time stamp;

    ChDir "C:\SFC\Archived\"
    ActiveWorkbook.SaveAs Filename:="C:\SFC\Archived\" & fname & "_chem" & ".html", FileFormat:=xlHtml, _
    ReadOnlyRecommended:=False, CreateBackup:=False

    It works fine by saving file as 03-24-06_chem.html. Now when I used the next code after the above code to save same excel file with given name as an html;

    ChDir "C:\SFC\" 'default directory for chem 7 days

    ActiveWorkbook.SaveAs Filename:="C:\SFC\chem-gas.html", FileFormat:=xlHtml, _
    ReadOnlyRecommended:=False, CreateBackup:=False

    It does save the file as chem-gas.html but dropping the new data.

    Here what i tried;

    I tried saving file;

    ActiveWorkbook.Save before running the above codes. Didn’t work.
    Since the excel has graph, i have to have FileFormat:=XLHtml. It does create a foler with all gif files in it.

    I was wondering some how if I can save both files by using the first code than i might not loss the data for the second file creation.

    Here is my complete macro coding;

    Sub chem7day()


    Dim newSecond
    Dim fname As String
    Dim i As Long

    fname = Format(Date, "yyyy-mm-dd")
    newSecond = Second(Now()) + 60 'Time Delay


    Calculate 'Calculating all sheets including updating charts with new data
    ActiveWorkbook.Save 'Saving file as an Excel format



    Sheets("2006").Select 'Before saving file the main sheet should be default
    Range("A2").Select 'Placing cursor to upper left


    If Weekday(Date) = 5 Then 'Condition to save file every Wednesday



    ChDir "C:\SFC\Archived\"
    ActiveWorkbook.SaveAs Filename:="C:\SFC\Archived\" & fname & "_chem" & ".html", FileFormat:=xlHtml, _
    ReadOnlyRecommended:=False, CreateBackup:=False
    'If condition true than saving file with current date with addition file name


    ‘The following code saving the file but without new data

    ChDir "C:\SFC\" 'default directory for chem 7 days

    ActiveWorkbook.SaveAs Filename:="C:\SFC\chem-gas.html", FileFormat:=xlHtml, _
    ReadOnlyRecommended:=False, CreateBackup:=False




    Else



    ChDir "C:\SFC\" 'default directory for chem 7 days

    ActiveWorkbook.SaveAs Filename:="C:\SFC\chem-gas.html", FileFormat:=xlHtml, _
    ReadOnlyRecommended:=False, CreateBackup:=Fal 'If this condition true than saving file as an html with given name




    End If
    End Sub
    Last edited by sam76210; 03-24-2006 at 03:52 PM.

+ 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