CSV Header Information

G

Guest

I have an excel program that converts excel files to csv files automatically
using VBA Macros. However, I am wanting to add csv print header information
example:
%!
XGF
9999 SETBUFSIZE
(,) SETDBSEP
QSTRIP_on
(GuntherIPEP.jdt) SETJDT
(IPEP.dbm) STARTDBM

The issue is that it must insert after csv conversion and not register as an
excel record. Is there VBA macros that will accomplish this for me? If so,
what would it be?
 
G

Guest

Thanks, sorry. Can't seem to get to the below website and what I have is not
working.
 
G

Guest

Finally got it! However, my programming is not accomplishing what I need. It
is outputing:
%!,XGF,9999 SETBUFSIZE,"(,) SETDBSEP",QSTRIP_on,(GuntherIPEP.jdt)
SETJDT,(IPEP.dbm)
STARTDBM,EMPLOYER,EE_STATE,EE_ZIP,APP_STATE,GENERIC_KIT_COUNT,START_DATE,END_DATE,PIN_CODE,CEO_LETTER_OPTION,CEO_LETTER_FROM,CEO_LETTER_TITLE,CEO_LETTER_DATE,HOW_LETTER_OPTION,HOW_LETTER_DATE,HOW_LETTER_FROM,HOW_LETTER_TITLE,HOW_LETTER_DEPT,ENROLLMENT_OPTION,GROUP_MEETINGS_WILL_BE,BENEFIT_COUNSELORS_WILL_BE,WILL_BE_DISTRIBUTED,CALL_CENTER_ENROLL_TELEPHONE_NUMBER,SELF_SERVE_START_DATE,SELF_SERVE_END_DATE,ACCIDENT,CANCER,CI,ISWL,LTC,MEDSUPPORT,STD,TERM_LIFE,VIUL,GROUP_LTC,GROUP_LTD,GROUP_STD,GROUP_TERM_LIFE,WEB_ADDRESS,OTHER1,OTHER2,OTHER3,OTHER4,OTHER5
HEADER TESTING,,,,,,,,,,,,,,,,,,,Y,,,,,A,,,,,,,,,,,,,,,,,,,,,,,,HEADER
TESTING,39024.68396

I need:
%!
XGF,9999 SETBUFSIZE
(,) SETDBSEP",QSTRIP_on
(GuntherIPEP.jdt) SETJDT
(IPEP.dbm) STARTDBM
EMPLOYER,EE_STATE,EE_ZIP,APP_STATE,GENERIC_KIT_COUNT,START_DATE,END_DATE,PIN_CODE,CEO_LETTER_OPTION,CEO_LETTER_FROM,CEO_LETTER_TITLE,CEO_LETTER_DATE,HOW_LETTER_OPTION,HOW_LETTER_DATE,HOW_LETTER_FROM,HOW_LETTER_TITLE,HOW_LETTER_DEPT,ENROLLMENT_OPTION,GROUP_MEETINGS_WILL_BE,BENEFIT_COUNSELORS_WILL_BE,WILL_BE_DISTRIBUTED,CALL_CENTER_ENROLL_TELEPHONE_NUMBER,SELF_SERVE_START_DATE,SELF_SERVE_END_DATE,ACCIDENT,CANCER,CI,ISWL,LTC,MEDSUPPORT,STD,TERM_LIFE,VIUL,GROUP_LTC,GROUP_LTD,GROUP_STD,GROUP_TERM_LIFE,WEB_ADDRESS,OTHER1,OTHER2,OTHER3,OTHER4,OTHER5
HEADER TESTING,,,,,,,,,,,,,,,,,,,Y,,,,,A,,,,,,,,,,,,,,,,,,,,,,,,HEADER
TESTING,39024.68396

My programming is:
Dim RowNdx As Integer
Dim ColNdx As Integer
Dim WholeLine As String
Dim FName As String

Application.ScreenUpdating = False

ColNdx = Range("A1").Column
RowNdx = Range("A1").Row
FName = "I:\06vs-EC Standard Kit Request Form\5 Daniel Huffine\Final Fully
Automated\Test new directions\CSV Header testing\FName.txt"
Open FName For Input Access Read As #1

While Not EOF(1)
Line Input #1, WholeLine
Cells(RowNdx, ColNdx).Value = WholeLine
ColNdx = ColNdx + 1

Wend
Close #1

Is their something I am doing wrong?
 
G

Guest

I thought you said you want to write/create a csv file with your data in it,
adding hour header at the top.

Your code is reading a file and putting it into Excel?

The lower part of the cited page has code to write a file.
 
G

Guest

I apologize, I am not an excel VBA Programmer. I am trying to coordinate this
to help some of our business partners and the websit you pointed me to says
that this was the code to add the header information. Is there any help?
 
T

Tom Ogilvy

Insert the necessary rows at the top

Put your header information at the top of your worksheet in a single column
(column A), multiple rows.

Then do your save as CSV.
 
G

Guest

I have tried this. The header information needs to only be recognized by the
printing program and not as a record in the xlcsv. That's why I was pulling
in as text. Once the csv conversion had taken place, pulling in the header
information as text allowed it to not be recognized as records. However, it
would show in the wrong order. See the example below. It is either pulling in
the information side by side or it will pull in the first column. It wouldn't
work that way. Any ideas?
 

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

Similar Threads


Top