Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA script to CSV export

Status
Not open for further replies.

YOHAYON

Technical User
Jul 31, 2001
6
0
0
CA
I'm working with a program called Cardiff Teleform which captures hand/machine print data or choice fields from images & as well allows VBA scripts to perform additional functionality.
I have multiple fields listing different Product ID & a user will enter in quantity ordered. Not all fields will be entered in with the value of quantity ordered. So if I have a field named "A123" & a value of "5" in this field, I need VBA to format the csv export so that Teleform will export data from the Teleform template in the following manner:

Only if quantity is completed
then perform this while exporting to csv comma delimited:
insert DETL in first cell of first available row
delete first character of fieldname (delete A)
insert fieldname into next cell ex: 123
insert quantity ordered into next cell.

So eachtime a quantity is entered, the data will be exported to a new row.
DETL then fieldname then quantity.
Example:
DETL,123,6,,,,,
DETL,456,2,,,,,
 
Sorry but what is your question? What part are you having trouble with?

Never knock on Death's door: ring the bell and run away! Death really hates that!
 
Thanks, ClulessChris. I'm having a problem creating the whole VBA script.
Requirement revision:
Only if quantity is completed
then perform this while exporting to csv comma delimited:
insert DETL in first cell of first available row
export value of description.field (which is the Product ID)
export quantity ordered into next cell.

So eachtime a quantity is entered, the data will be exported to a new row.
DETL then description.field then quantity.
Example:
DETL,123,6,,,,,
DETL,456,2,,,,,
 



Hi,

If you have your data entered in and Excel worksheet in the proper columns, then to create a .csv, you do NOT need VBA code.

Just SaveAs as .csv and you will get what you expect, I believe.

Turn on your macro recorder to generate code for this process.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Thanks, Skip. My first post tells that I'm working with a program called Cardiff Teleform which captures hand/machine print data or choice fields from images & as well allows VBA scripts to perform additional functionality. I need to capture data from images & use VBA script to export this data to csv in a format I require.

Only if quantity field is completed by userthen perform this while exporting to csv comma delimited:
insert DETL in first cell of first available row
export value of description.field (which is the Product ID)
export quantity ordered into next cell.

So eachtime a quantity is entered, the data will be exported to a new row.
DETL then description.field then quantity.
Example:
DETL,123,6,,,,,
DETL,456,2,,,,,

 


I have not idea what the Cardiff Teleform object model is.

What object do you enter the data into?

What are the properties of this object?

What methods does this object have?

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Hi yohayon,

I see you've posted the same Q at:
Please see:
You might have noticed that this is a VBA Visual Basic for Applications (Microsoft) Forum, which means it's for Microsoft's vba implementations for that company's applications. Cardiff Teleform isn't such an application and, unless you can provide both a comprehensive rundown on that application's vba object model and its data file's structure, your prospects of getting help here are somewhat limited. In fact, you'll find that to be the case anywhere except in a specialised Cardiff Teleform forum.


Cheers
[MS MVP - Word]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top