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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Load comma delimited string to worksheet

Status
Not open for further replies.

ToddR

Programmer
Feb 28, 2001
35
US
I would like to pass a comma delimited string to a VB function that opens an Excel Application, adds a workbook, then loads a worksheet using the string as data. I would then save the worksheet in .xls format.

Any ideas on the best way to get the comma delimited fields into the spreadsheet?

Thanks in advance
 
What you can do is: From database window, go to File/Get External Data/Import. When you locate and select the file you are trying to import, you can use the import wizard to specify delimited fields and if you click the advanced button in the wizard, you can format the record fields however you like, as well as name them [you can even skip over fields, only importing the data needed]. Then you can call the layout whatever you like and save it. Next, create a macro to TransferText; at the bottom, select import delimited and on the Specification line below it, type in the name you saved the import wizard layout as. The rest of the macro easy - specifying tablename to send imported data to, etc. Then you can use the new table to do what you need.
 
Workbooks.Open Filename:= MyFile.csv

Activeworkbook.SaveAs Filename:= MyFile.xls FileFormat:=xlNormal Store300

Store300@ftnetwork.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top