Boiler Plateing text into another text document.
keiji kounoike wrote:
Geoff E wrote:
On Sep 14, 12:47 pm, keiji kounoike <"kounoike A | T
ma.Pikara.ne.jp" wrote:
I don't know what "H:\Tam\testText.txt" is and how you like to have your
"importBoPl.htm" look. I guessed this is what you are looking for but
I'm not sure.
Keiji... Thank you for your reply
"H:\Tam\testText.txt" is the path to the file that contains the text
to be imported. That text is in the form of a collection of
paragraphs, much like that which you would expect to see in a letter.
It does not contain delimited data which would be subjected to further
processing.
"H:\" is the identity of a flash drive which I am using for testing
purposes.
"importBoPl.htm" Is the name of the destination file which is the
script for a web page.
I actually tried your routine but, unfortunately, it did not
work.However, there was some very useful information on there so I
adjusted my routine to reflect what I learnt from yours. It still does
not work, but it now looks like this:
Public Sub importBoilerPlate()
Dim i As Long
Dim streng As String
On Error GoTo err_handler
ActiveWorkbook.Save
'================================================= ==================
Myfile = "H:\MsTamsin\importBoPl.htm"
Open Myfile For Output As #1
Print #1, "<html<body<center<h2Page Heading</h2"
Print #1, "Standard generated text - not imported "
Print #1, "<table<tr<td"
MyBoilerPlate = "H:\MsTamsin\testText.txt"
Open MyBoilerPlate For Output As #2
i = 0
Do While Not EOF(2)
Line Input #2, streng
Print #1, "streng"
i = i + 1
Loop
Close #2
Print #1, "</td</tr<tr<td"
Print #1, "Monday 14th September 1327 hrs"
Print #1, "</td</tr</table</center</body</html"
Close #1
'================================================= ====================
Exit Sub
err_handler:
MsgBox Err.Number & vbCrLf & Err.Description
End Sub
Looking forward to further assistance on this matter.
Geoff E
If you don't mind, let me know how did my code not work.
Anyway, I think the line Print #1, "streng" in your code above should be
Print #1, streng
("" should not be added)
In your code, Print #1, "streng" will write the string "Strng" itself
into the importBoPl.htm file.
I think you should put Close #1 and Close #2 in error handle. if not, if
error ocuurs, then you can't open your files next time.
P.S I wonder what the variable i means?
Keiji
|