Creating text file via VBA and need double quotes around several columns

kweaver

Well-known Member
Joined
May 12, 2009
Messages
2,934
Office Version
  1. 365
  2. 2010
After a number of calculations and manipulations, I have a sheet which ultimately needs to be saved as a txt file.
That's no problem.
However, there are several columns (some of which are numeric and some are text) that need double quotes around them (front and back).
So, if a column has: 23467, I need the result to be: "23476"
I'm able to do that using CHR(34), but when the sheet is save as a txt file, that process throws two sets of double quotes on the front and back.
In this example, the resulting text file column has: """23476""" in it.

As an example, here's the sheet with the quotes I've concatenated on both sides in column B.
But, as I said, when it's saved as a txt file, I get the above add'l quotes.

Book48
ABCDEFGHI
101/07/2021"23467"1038024REG6.00
201/07/2021"23467"1038105REGCARP2.00
301/07/2021"23467"1038105OTCARP1.00
401/04/2021"23467"1028024REGLABOR2.00
501/04/2021"23467"1038225REGCARP2.00
601/04/2021"23467"1038225REGGLAZ4.00
701/04/2021"23467"1038225OTGLAZ1.00
801/05/2021"23467"1038105REGCARP5.00
901/05/2021"23467"1038106REGIRON-ORN3.00
Reformatted
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Forum statistics

Threads
1,214,926
Messages
6,122,306
Members
449,079
Latest member
juggernaut24

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top