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

Allowing varibles to be available in another application

Status
Not open for further replies.

eddy556

Programmer
Mar 5, 2007
7
GB
Hi, is it possible to somehow allow a vba variable to be available within another application.

What I am wanting to do is for a macro to realise that it was executed by another application and therfore run a different set of code.

What I was thinking to do was set a 'flag' variable and if it has been set to 'true' by the other application which has run it then different code is run by the executed macro.

I hope you understand what I mean...

Thanks for you help :)
 
How is your access VBA code executed by another (which ?) application ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Well I'm not sure if this is the right way but this seems to execute functions in the other application:

oApp.Run "samedayInvoice.xls!Save_Invoice
 
What is oApp ? an Excel.Application object ?
Provided that the Save_Invoice admits a Boolean argument:
oApp.Run "samedayInvoice.xls!Save_Invoice", True

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Okay thanks for your help but I'm still a bit confused.

oApp.Run "samedayInvoice.xls!Save_Invoice" is just an example what I am actually trying to run iso "samedayInvoice.xls!Reset_Invoice" which has two buttons, one on the Excel spreadsheet, and one on an Access form.

What I want is for when the user activates Reset_Invoice on the spreadsheet, a msgbox pops up asking wether they are sure. But when it is activated using the database, there is no msgbox.

Much appreciated
 
The Excel button's code:
Application.Run "samedayInvoice.xls!Save_Invoice", True
The Access button's code:
oApp.Run "samedayInvoice.xls!Save_Invoice", False
The Excel macro:
Public Sub Save_Invoice(bRunFromXL As Boolean)
If bRunFromXL Then
MsgBox ...
...



Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi, thanks! I'm getting an ambiguous name error? Do you know what that means?

Thanks
 
I'm getting an ambiguous name error
Which name ? Where ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top