Send parameter to Macro from VB

marnieg

Registered User.
Local time
Today, 15:37
Joined
Jul 21, 2009
Messages
70
I have a macro that imports data using the TransferText Action. I want to pass the "File Name" from my VB code as a parameter. Currently having to hard code the file name in the macro, but want to pass it as a parameter.

Here is my code for running the macro.

DoCmd.RunMacro "importlead"

I want to have a field on my form that allows them to enter the filename and path and send it to the macro.

Thanks for any assistance.
Marnie
 
Not sure if you can, unless it can be done with TempVars, which I haven't used. I'm curious why you don't convert the macro to code and do it all in VBA, where it would be simple?
 
I can't create a save spec for my file layout because it is an ADP file not a MDB. When I try to create one on the Import/Export Wizard the option to save the spec is greyed out. On my macro I'm just leaving the spec blank. Don't know if I can leave it blank in the VB code. Will try

Thanks,
Marnie
 
Was able to add TransferText function to VB code so don't need Macro.

Thanks,
Marnie
 
Happy to help Marnie.
 

Users who are viewing this thread

Back
Top Bottom