Publish Multiple Worksheets as Separate HTML files from 1 workbook

BoJaques

New Member
Joined
Jan 15, 2015
Messages
1
Is there any way to publish multiple worksheets in the same workbook to multiple HTML locations.

So 1 Workbook.

Sheets:
Car- Published as Car.html
Truck- Published as Truck.html
Van- Published as Van.html

Hopefully that makes sense.
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
If you know VBA, enable the "Microsoft Scripting Runtime" reference, which allows access to the TextStream object (used for creating text files). You'll need to figure out a way to read your sheets' data into the StrData variable. Currently, only the first cell in each sheet is being written into the text file(s).

Code:
Sub CreateHTML()
Dim Ws As Worksheet
Dim FSO As FileSystemObject
Dim Ts As TextStream
Dim StrData As String

Set FSO = CreateObject("Scripting.FileSystemObject")

For Each Ws In ThisWorkbook.Worksheets
    StrData = Ws.Cells(1, 1).Value
    Set Ts = FSO.CreateTextFile("C:\Users\Me\Desktop\" & Ws.Name & ".html", True)
    Ts.Write (StrData)
    Ts.Close
Next Ws

End Sub
Good luck.

David
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,853
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top