Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default quotation marks before and after each input

JE,

I did get it to work and thanks again.

Can you tell me how to add the double quotes on the end column.
If I have a blank column in the the middle it will put the double
quotes, but my last column is currently blank and I need the double
quotes there.

Also, If I have a dollar sign, such as $45.00, it adds and extra
space after it and before the quotes such as $45.00 "

Can you help me on these???

Thanks.


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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default quotation marks before and after each input

This modification will output a fixed field text file with quotes around
each item. Adjust NUMFIELDS as necessary. The space after $45.00 comes
from your formatting (e.g., Currency formats as $0.00_(, to allow
positive and negative numbers to line up). Using RTrim removes any
trailing spaces:

Public Sub OutputQuotedCSV()
Const QSTR As String = """"
Const NUMFIELDS As Long = 10
Dim myRecord As Range
Dim myField As Range
Dim sOut As String

Open "File1.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 myRecord.Resize(, NUMFIELDS)
sOut = sOut & "," & QSTR & _
Replace(RTrim(myField.Text), QSTR, QSTR & QSTR) & QSTR
Next myField
Print #1, Mid(sOut, 2)
sOut = Empty
End With
Next myRecord
Close #1
End Sub


In article ,
iamalex wrote:

JE,

I did get it to work and thanks again.

Can you tell me how to add the double quotes on the end column.
If I have a blank column in the the middle it will put the doublequotes, but
my last column is currently blank and I need the doublequotes there.

Also, If I have a dollar sign, such as $45.00, it adds and extra
space after it and before the quotes such as $45.00 "

Can you help me on these???

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default quotation marks before and after each input

You have been a great help.
Thank you much

--
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 9pluck9 Excel Discussion (Misc queries) 2 May 2nd 07 04:40 PM
Quotation Marks? LinearChaos Excel Worksheet Functions 2 June 25th 06 10:31 PM
without quotation marks? jfazz Excel Discussion (Misc queries) 1 March 2nd 06 04:43 PM
Quotation Marks - When and What?? heski Excel Discussion (Misc queries) 2 February 7th 06 12:40 PM
quotation marks JohnF Excel Worksheet Functions 7 February 5th 06 09:33 PM


All times are GMT +1. The time now is 05:11 PM.

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

About Us

"It's about Microsoft Excel"