Try this, maybe, using FileSystemObject
to create the text file/html file:
Public Const strResult As String = "<META http-equiv=""Content-Type"" content=""text/html"">" '"document.writeln('<div class=""pagebreak"">');"
Sub Test()
Dim sFile As String
Dim fso As Object 'Scripting.FileSystemObject
sFile = "C:\users\" & Environ("username") & "\desktop\TNTLabel.html"
Set fso = CreateObject("Scripting.FileSystemObject")
fso.CreateTextFile(Filename:=sFile, Overwrite:=True).Write strResult
Set fso = Nothing
End Sub
This creates the following text file, note that there are no double-quotes and I did not use any Replace
or other string functions to remove them from the strResult
:
Alternatively, when I used freefile method to write the file, it preserves it as string literal, where the double-quotes are required as an escape character. I am still not sure that you should be "replacing" or removing these, since this is an HTML file which includes script/javascript, so you have string script inside a string HTML. In my very limited web/HTML experience, this might actually be necessary to properly escape the characters, or as JLRishe suggests, perhaps this is correct for XSLT.
Open "C:\users\chris\desktop\TNTLabel.html" For Output As #1
Write #1, strResult
Close #1