G
Geoff E
I am trying to import the content of a ".txt" file into a formatted
web page. I seem to have a good grasp on the writeing part but not the
reading (importing) part.
The following is where I am at at the moment:
Public Sub importBoilerPlate()
Dim i As Long
Dim streng As String
On Error GoTo err_handler
ActiveWorkbook.Save
'===================================================================
Myfile = "H:\Tam\importBoPl.htm"
Open Myfile For Output As #1
Print #1, "<html><body><center><h2>Heading</h2>"
Print #1, "Standard generated text - not imported "
Print #1, "<table><tr><td>"
MyBoilerPlate = "H:\Tam\testText.txt"
Open MyBoilerPlate For Output As #2
i = 0
Do While Not EOF(1)
Line Input #2, streng {I suspect my problem lays on this line}
i = i + 1
Loop
Close #2
Print #1, "</td></tr><tr><td>"
Print #1, "Saturday 12th September 0942hrs"
Print #1, "</td></tr></table></center></body></html>"
Close #1
'=====================================================================
Exit Sub
err_handler:
MsgBox Err.Number & vbCrLf & Err.Description
End Sub
This is what is produced:
<html><body><center><h2>Heading</h2>
Standard generated text - not imported
<table><tr><td>
{Note: The imported text should appear in here.}
</td></tr><tr><td>
Saturday 12th September 0942hrs
</td></tr></table></center></body></html>
Your comments, suggestions and assistance would be greatly
appreciated.
web page. I seem to have a good grasp on the writeing part but not the
reading (importing) part.
The following is where I am at at the moment:
Public Sub importBoilerPlate()
Dim i As Long
Dim streng As String
On Error GoTo err_handler
ActiveWorkbook.Save
'===================================================================
Myfile = "H:\Tam\importBoPl.htm"
Open Myfile For Output As #1
Print #1, "<html><body><center><h2>Heading</h2>"
Print #1, "Standard generated text - not imported "
Print #1, "<table><tr><td>"
MyBoilerPlate = "H:\Tam\testText.txt"
Open MyBoilerPlate For Output As #2
i = 0
Do While Not EOF(1)
Line Input #2, streng {I suspect my problem lays on this line}
i = i + 1
Loop
Close #2
Print #1, "</td></tr><tr><td>"
Print #1, "Saturday 12th September 0942hrs"
Print #1, "</td></tr></table></center></body></html>"
Close #1
'=====================================================================
Exit Sub
err_handler:
MsgBox Err.Number & vbCrLf & Err.Description
End Sub
This is what is produced:
<html><body><center><h2>Heading</h2>
Standard generated text - not imported
<table><tr><td>
{Note: The imported text should appear in here.}
</td></tr><tr><td>
Saturday 12th September 0942hrs
</td></tr></table></center></body></html>
Your comments, suggestions and assistance would be greatly
appreciated.