#1
|
|||
|
|||
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 |
#2
|
||||
|
||||
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 [Fmr MS MVP - Word] |
#3
|
|||
|
|||
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! |
#4
|
||||
|
||||
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 [Fmr MS MVP - Word] |
Tags |
word vba " |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Define custom Cross-reference output format to include "static" text and pg numbers | cyclops755 | Word VBA | 9 | 01-17-2023 02:42 PM |
Wildcard replace any string in context with a specified string | wardw | Word | 7 | 05-07-2018 09:13 AM |
Advanced Replace -- Incorrect Output Order | cheech1981 | Word | 2 | 09-18-2017 04:44 PM |
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 |
Macro VBA "Save as" with bookmarks in file name string | Dom37 | Word VBA | 2 | 10-31-2011 03:28 AM |