Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default eliminating quotation marks when writing to a text file

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

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default eliminating quotation marks when writing to a text file

Take a look at

http://www.mcgimpsey.com/excel/textf...ml#csvnoquotes


In article ,
margrabe wrote:

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 when
I run the above code, the file displays the following: "". The source
code displays: "<HTML</HTML". How do I keep those quotation marks
from showing up?

Thanks.

Billy


---
Message posted from http://www.ExcelForum.com/

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default eliminating quotation marks when writing to a text file

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

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default eliminating quotation marks when writing to a text file

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
on this site may be distributed under the Gnu GPL. Acknowledgement is
appreciated.

"margrabe <" wrote:

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

Billy

---
Message posted from http://www.ExcelForum.com/


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default eliminating quotation marks when writing to a text file

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

--
Message posted from http://www.ExcelForum.com



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default eliminating quotation marks when writing to a text file

Try replacing Write with Print.

--
Regards,
Tom Ogilvy


margrabe wrote in message
...
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 when
I run the above code, the file displays the following: "". The source
code displays: "<HTML</HTML". How do I keep those quotation marks
from showing up?

Thanks.

Billy


---
Message posted from http://www.ExcelForum.com/



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Quotation Marks as Text Kelly C Excel Discussion (Misc queries) 2 August 3rd 08 06:20 PM
Generating text surrounded by quotation marks AaronQRules (a.k.a. Jeff) Excel Discussion (Misc queries) 5 July 30th 07 08:12 PM
CSV File and Maintaining Quotation Marks in TXT rammstein Excel Discussion (Misc queries) 0 February 23rd 06 10:18 PM
How do I concatenate text that actually contains quotation marks? Excel Distress Excel Worksheet Functions 3 April 15th 05 02:23 PM
eliminating quotation marks when writing to a text file margrabe Excel Programming 0 February 9th 04 04:21 PM


All times are GMT +1. The time now is 07:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"