Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-26-2020, 08:55 AM
gedinfo2020 gedinfo2020 is offline Replace " in string sent to output file Windows 10 Replace " in string sent to output file Office 2019
Novice
Replace " in string sent to output file
 
Join Date: Feb 2020
Posts: 2
gedinfo2020 is on a distinguished road
Smile Replace " in string sent to output file

Hello, I am sending a csv formatted data to an output file, and find that the string that I put the data into ends up with " at the start, followed by a CR\LF and " at the end.


I do not directly enter the leading " or the ending CR/LF ".

I have screen shots saved as .png to demonstrate what I mean, but do not have web storage for these.

Via VBA, I wish to eliminate the extra 'formatting', as this causes the csv file to not be imported into Excel correctly.

Thank you for any suggestions.

Last edited by gedinfo2020; 02-26-2020 at 11:35 AM. Reason: attempt to add image attachments
Reply With Quote
  #2  
Old 02-26-2020, 04:14 PM
macropod's Avatar
macropod macropod is offline Replace " in string sent to output file Windows 7 64bit Replace " in string sent to output file Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 20,040
macropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud of
Default

You don't need a macro for this. If those are the only " in the file, a simple Find/Replace can be used to delete them. Otherwise, your could use:
Find = "^p"
Replace = ^p
then delete the " at the start of the file and the " at the end.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #3  
Old 02-27-2020, 07:14 AM
gedinfo2020 gedinfo2020 is offline Replace " in string sent to output file Windows 10 Replace " in string sent to output file Office 2019
Novice
Replace " in string sent to output file
 
Join Date: Feb 2020
Posts: 2
gedinfo2020 is on a distinguished road
Default

I find out that the addition of the quotes are from the Write #1 call.
I verified that the string is missing the quotes prior to this call.
When I view the file, the quotes are there!
Reply With Quote
  #4  
Old 02-27-2020, 02:30 PM
macropod's Avatar
macropod macropod is offline Replace " in string sent to output file Windows 7 64bit Replace " in string sent to output file Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 20,040
macropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud of
Default

Since you haven't posted the code that's producing the CSV, it's difficult to know why you're using 'Write #1' instead of 'Print #1' - which wouldn't add the quotes. Obviously, not using methods that add the quotes is preferable to adding them, then having to remove them.

Regardless, I've also told you how you can remove them.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
Reply

Tags
word vba "

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Replace " in string sent to output file Wildcard replace any string in context with a specified string wardw Word 7 05-07-2018 09:13 AM
Replace " in string sent to output file Advanced Replace -- Incorrect Output Order cheech1981 Word 2 09-18-2017 04:44 PM
Replace " in string sent to output file Define custom Cross-reference output format to include "static" text and pg numbers cyclops755 Word VBA 4 03-04-2016 03:36 PM
Replace " in string sent to output file Way to search for a string in text file, pull out everything until another string? omahadivision Excel Programming 12 11-23-2013 12:10 PM
Replace " in string sent to output file Macro VBA "Save as" with bookmarks in file name string Dom37 Word VBA 2 10-31-2011 03:28 AM


All times are GMT -7. The time now is 09:04 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2020 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft