Exporting to CSV or Text files with variable ranges on a worksheet

N

Neale

Hi. I've tried finding solutions from the myriad previous postings on
similar subjects, but find myself even more confused! (Am almost a
complete novice in VBA.)

My problem is that I need to create a csv file in Notepad that contains
a header of 4 fields structured as follows:

Indicator Date/Time User ID Batch #
CI 20050705123222 nmorse 1

A footer that contains 3 fields structured as follows:

Indicator Total # Records Hash Total
99 7 100.000

and a body that contains a variable number of row entries, each row
contains 16 fields, some of which are not compulsory, but the output
requires the consecutive delimiters (without empty strings)for the
empty column fields.

The date and time in the header needs to be created at the time of the
entries into the body in the format yyyymmddhhmmss (which is also
causing me a problem or two) and the total records and the hash total
are the count and sum of the variable number of entries made into the
body part of the worksheet, so I can't just hardcode these values
somewhere to use each time. The userId can be generated by using the
Windows userId so that's not a problem (I'm pretty sure I can handle).
The batch # needs to be sequential dependent on the number of files
generated by each user, each day.

I've structured my worksheet as outlined above. Admitting defeat on
this. All help greatly appreciated and gratefully accepted!

Cheers

Neale
 

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

Top