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.
 

Some videos you may like

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

Fat Cat

Active Member
Joined
Nov 5, 2004
Messages
336
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
 

Watch MrExcel Video

Forum statistics

Threads
1,118,674
Messages
5,573,597
Members
412,537
Latest member
Mohamed_5966
Top