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

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

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
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,020
Messages
5,834,989
Members
430,331
Latest member
Syed Yasir Hannan

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
Top