![]() |
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 |
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/ |
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 |
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 |
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 |
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/ |
All times are GMT +1. The time now is 07:29 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com