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!

Is it possible to embed some VBA code into an .csv file?

Status
Not open for further replies.

qmacg

Technical User
Aug 20, 2001
47
US
Ok, i'm really, really reaching here, but I'm sure someone has pulled it off somewhere. Here goes...
I want, well really have to export a table in a .csv format instead of .xls for excel. Reason for this (to make a long story short), I'm exporting a bunch of memo fields, since memos can hold around 65000 chars or so, exporting to excel would involve create a convoluted remaining text array. Anyway, back to the point.. As I export the table using the docmd.TransferText function I was wondering if it was possible to insert some macro code into that .csv file. So the user would open the file and run a macro by going to the control menu and pressing Macro, select macroa .etc. Now stay with me here don't blast me just yet, I know it's a .csv file (i.e. text), but I think this can really work. If anyone knows the procedure to attach VBA code into a regular excel document I'll try to use and Excel.Application object in my VBA code in Access to embed the macro code into .csv file. Any help would be appreciated. :-/
 
procedure to attach VBA code into a regular excel document
In the excel project you should add a reference to Visual Basic For Applications Extensibility
and then you may use the Excel.Application.VBE.ActiveVBProject.VBComponents.Import method.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top