eliminating quotation marks when writing to a text file

M

margrabe

Hi. Below is a very simple macro.

Sub WriteText()

Open "test.html" For Append As #1
Write #1, "<HTML></HTML>"
Close

End Sub

All I want to do is create an HTML file based on user inputs. But whe
I run the above code, the file displays the following: "". The sourc
code displays: "<HTML></HTML>". How do I keep those quotation mark
from showing up?

Thanks.

Bill
 
M

margrabe

Thanks for the response. Unfortunately, I was unable to access th
page. Could be something on my end, I don't know. Could you post th
text in a message here?

Bill
 
D

Dave Peterson

Text files with no modification

This macro will output a text file without surrounding cells which have commas
in quotation marks, or doubling quotation marks in the text:

Public Sub TextNoModification()
Const DELIMITER As String = "," 'or "|", CHR(9), etc.
Dim myRecord As Range
Dim myField As Range
Dim sOut As String

Open "Test.txt" For Output As #1
For Each myRecord In Range("A1:A" & _
Range("A" & Rows.Count).End(xlUp).Row)
With myRecord
For Each myField In Range(.Cells(1), _
Cells(.Row, Columns.Count).End(xlToLeft))
sOut = sOut & DELIMITER & myField.Text
Next myField
Print #1, Mid(sOut, 2)
sOut = Empty
End With
Next myRecord
Close #1
End Sub

This page last updated Sunday, 4 January 2004

© Copyright 2001 - 2004 McGimpsey and Associates. Except where noted, all code
 
M

mudraker

To eliminate the " at the start and and of each line that you get whe
using

Write #1, "<HTML></HTML>"

try using

Print #1, "<HTML></HTML>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top