Forum rules Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 14 years and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
I am trying to get a Word document that was saved as a .htm file into a DataArea.InnHTML span and I keep getting an Unspecified error. I would like to keep this as a file as this is instructions for using the HTA and would like to only update a file and not have to modify the HTA but keep the formating in the document.
This is what I am using to read the file but I suspect that the extra HTML is causing the error.
Const ForReading = 1
Dim instrFileLoc : instrFileLoc = "C:Test_2.htm"
Dim fso1 : Set fso1 = CreateObject("Scripting.FileSystemObject")
Dim f : Set f = fso1.OpenTextFile(instrFileLoc,ForReading)
Dim strInstructions : strInstructions = f.ReadAll
f.Close
Sub window_onLoad
CheckForNewHTA 'Checks for new HTA on the O:Drive
window.resizeTo 1200,800
AppName.InnerHTML = strAppName
AppVersion.InnerHTML = strAppVer
'TextBox1.Focus
AppDate.InnerHTML = strDate
DataArea.InnerHTML = strInstructions
End Sub
I am trying to get a Word document that was saved as a .htm file into a DataArea.InnHTML span and I keep getting an Unspecified error. I would like to keep this as a file as this is instructions for using the HTA and would like to only update a file and not have to modify the HTA but keep the formating in the document.
This is what I am using to read the file but I suspect that the extra HTML is causing the error.
Const ForReading = 1
Dim instrFileLoc : instrFileLoc = "C:Test_2.htm"
Dim fso1 : Set fso1 = CreateObject("Scripting.FileSystemObject")
Dim f : Set f = fso1.OpenTextFile(instrFileLoc,ForReading)
Dim strInstructions : strInstructions = f.ReadAll
f.Close
Sub window_onLoad
CheckForNewHTA 'Checks for new HTA on the O:Drive
window.resizeTo 1200,800
AppName.InnerHTML = strAppName
AppVersion.InnerHTML = strAppVer
'TextBox1.Focus
AppDate.InnerHTML = strDate
DataArea.InnerHTML = strInstructions
End Sub
I would suggest using a iFrame vs writing the data to a SPAN, otherwise you're placing another entire HTML document inside of another which would mess your tags all up. Some of the other members might tell me I'm crazy, but it's what I would try.
Sub window_onLoad
Dim ie : Set ie = CreateObject("InternetExplorer.Application") ie.Navigate("C:Test_3.htm") Dim ieInner : ieInner = ie.Document.body.InnerHTML DataArea.InnerHTML = ieInner
end sub
[/code
This topic is 14 years and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.