Forum Moderators: phranque
I would assume the file is one keyword phrase per line, if so it ought to just import into Excel with each keyword phrase on its own line - in A1, A2, A3 etc.
If so just use a Macro like this:
Sub MakeFiles()
Const Path$ = "C:\relevant\directory\"
Dim FileName As String
Range("A1").Select
While Not IsEmpty(ActiveCell.Value)
FileName = ActiveCell.Value
Open Path$ + FileName + ".html" For Output As 1
Close 1
ActiveCell.Offset(1, 0).Range("A1").Select
Wend
End Sub
I use something similar, but I haven't actually tested this version so no warranty given or implied :)
It won't add any hyphens or anything, although it wouldn't be hard to make it do so (make a function that parses each FileName and replaces spaces with hyphens).
Sub MakeFiles()
Const Path$ = "C:\directory\"
Dim FileName As String
Range("A1").Select
While Not IsEmpty(ActiveCell.Value)
FileName = Replace(ActiveCell.Value, Chr$(32), "-", 1)
Open Path$ + FileName + ".html" For Output As 1
Print #1, "Text"
Print #1, "<br>"
Print #1,
Print #1, "Text2"
Close 1
ActiveCell.Offset(1, 0).Range("A1").Select
Wend
End Sub
[edited by: oilman at 9:28 pm (utc) on Nov. 14, 2003]