+ Reply to Thread
Results 1 to 2 of 2

SAVING Excel file as HTML

  1. #1
    Registered User
    Join Date
    01-04-2020
    Location
    Manila, Philippines
    MS-Off Ver
    2016
    Posts
    1

    SAVING Excel file as HTML

    I need help with this.

    I have column A ( which to be used as the file name)
    and the data should be saved as Column B but in HTML format

    The output should be HTML file and when you open it you will find the data from column B

    HELP.png

    Sub SaveAs_HTML()
    Const ForReading = 1, ForWriting = 2, ForAppending = 3
    Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0

    Dim fs, f, ts, s
    Dim WS_Src As Worksheet, Rng As Range, c As Range, d As Range
    Dim Folder As String

    Folder = "C:"
    Set WS_Src = ThisWorkbook.Worksheets("a")
    Set Rng = WS_Src.Range("a1", WS_Src.Range("a" & Rows.Count).End(xlUp))
    For Each c In Rng
    Set fs = CreateObject("Scripting.FileSystemObject")
    fs.CreateTextFile Folder & c.Value & ".html"
    Set f = fs.GetFile(Folder & c.Value & ".html")
    Set ts = f.OpenAsTextStream(ForWriting, TristateUseDefault)
    For Each d In Intersect(c.EntireRow, WS_Src.UsedRange)
    ts.write d.Value & Chr(9)
    Next
    ts.Close
    Next
    End Sub


    it turned out like this

    Untitled.png

    How can Column A not show in HTML file? without deleting it ? because i need that row for naming all files
    Attached Files Attached Files
    Last edited by gleizzable; 02-25-2021 at 11:18 AM.

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: SAVING Excel file as HTML

    Just guessing here looking at the code. I think the line that needs to be modified is

    Please Login or Register  to view this content.
    Try changing this to
    Please Login or Register  to view this content.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. VBA to Import HTML Table Locally Stored HTML file to excel
    By ermengard in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-09-2015, 10:48 AM
  2. Saving Excel as .html
    By kizterelyk in forum Excel General
    Replies: 0
    Last Post: 05-31-2012, 07:07 PM
  3. Saving as a HTML file
    By Dan Mackman in forum Excel General
    Replies: 0
    Last Post: 11-20-2007, 04:02 PM
  4. Opening HTML file - saving as XLF with PNG file
    By srm in forum Excel General
    Replies: 0
    Last Post: 06-29-2006, 06:25 PM
  5. Saving Excel file as HTML USING C#
    By Kewal in forum Excel General
    Replies: 0
    Last Post: 04-07-2006, 08:30 AM
  6. [SOLVED] Problem saving Excel file in HTML format
    By nicol in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-24-2006, 06:45 AM
  7. Saving Excel chart to HTML
    By Al in forum Excel General
    Replies: 1
    Last Post: 03-23-2005, 03:06 AM

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