Create external files with Excel

mrfitz

New Member
Joined
Nov 23, 2005
Messages
1
Hello,

wondering if anyone knows how I can create a bunch of HTML files in Excel. I have one column (A) with name of file. I have added html tags for the template of all pages in column (B). I'd like to run some macro or function that will create the html file in a directory on d:\htmlfiles by the name of the document in column A that contains the HTML from column B? Is this possible - could anyone help. I am a real novice. Any assistance would be greatly appreciated.
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
An Html file is essentially a TEXT file, so you can just use the normal file commands;

Code:
Dim myFileName As String
Dim numLines As Long

myFileName = Cells(1,1).Text
numLines = 10

Open myFileName For Output As #1
For i=1 To numLines
  Write #1, Cells(i,2).Text
Next i
Close #1
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,551
Members
449,088
Latest member
davidcom

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