Exporting to CSV without text qualifiers

  • Thread starter Thread starter Centurius
  • Start date Start date
C

Centurius

Hi guys,
I've been fiddling with VBA again, and seem to have come unstuck.
I work at a cabinetmakers, and I'm writing a macro to export a list of
parts to a program that talks to our saw. The program uses a CSV file
to read in all the sizes, descriptions etc etc.

Problem is, that i need one of the fields to equal " " (with the
qualifiers)
I've tried the following, and countless others, but these seem to be
the closest

Workbooks(Paste_Book).Activate 'D = " " (Material String
Field 2)
Range("D1:D" & bot2).Value = """ """

Workbooks(Paste_Book).Activate 'D = " " (Material String
Field 2)
Range("D1:D" & bot2).Value = " "

The first looks right when I open the xls file (before it exports to
csv), but after the exporting, it gives me """ """ in the cell

the second gives me a space only in excel, and after the exporting,
also leaves me with only a space... and no qualifiers

hope that made a little bit of sense, and i hope someone here can help.

thanks in advance!
 
as a further note,
the saw program requires text qualifers ("" 's) surrounding each
non-numerical field. and they only seem to be written into the CSV when
there is non alpha-numerical characters in the cell (ie. the text
qualifer ")
so if i leave the text qualifiers out i get none.. and if i put them in
(before the exporting) then i end up with 3!

i only want one =(
 
and in case this has something to do with it (probably is where the
problem lies..)

the following is the line i eventually use to export to CSV

ActiveWorkbook.SaveAs Filename:=thisname & ".pts", FileFormat:= _
xlCSVMSDOS, CreateBackup:=False
 
at the moment, i'm running my macro, then opening the exported CSV file
in notepad, and doing a find/replace """ with "
this fixes it right up and the saw program can open it no worries...

as much as i enjoy talking to myself, i think i'll leave it to the
experts now.
either a way to stop excel adding its own text qualifiers, or even a
workaround way to make notepad or similar do the replacing
automatically, would be much appreciated

thanks in advance,
Dan

(centurius [at] hotmail dot com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top