Macro and VBA

B

brettc

Is there a way to set a variable within the macro that the macro can use for
different steps?? Specifically, I want to be able to pass a value to a VBA
function. Also, is there a way to take the "output to" command's file
name/path setting and put so type of variable in it to get the file name to
change so I can avoid outputted files overwritting each other.
 
S

Steve Schapel

Brettc,

As far as I know, it is not possible to use a memory-held variable in a
macro. The closest you will get, is the OpenArgs property of a form, or
the Tag property of a form or of a control, both of which can have
considerable usefulness.

Yes, you can do what you are asking in the Output File argument of the
OutputTo macro action, as long as the "variable" is data driven. For
example, you could use the current date in the file name, such as...
="C:\YourFolder\file" & Format(Date(),"yymmdd") & ".txt"
.... or you could use a domain aggregate function such as DLookup or DMax
to retrieve a field value or part thereof from somewhere in your database.
 

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