View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
XP XP is offline
external usenet poster
 
Posts: 389
Default run access macro from excel pass parameter

Not really.

Try placing a test program in Access that displays an alternate message
based on the argument passed. For example:

Sub Test(argTest)
If argTest = "Hello" Then
Msgbox "Hello"
Else
Msgbox "Goodbye"
End if
End Sub

When making a call, change the contents of your parameter to either "Hello"
or "Goodbye" and see if the correct message is displayed. If not, then
perhaps your parameter isn't being loaded correctly before the call takes
place?

HTH


"Souris" wrote:

Thanks for the message,
It works from Excel side, but Access macro does not recongnize the parameter
from Excel.

The Access Macro execute the same parameter no matter what Excel sends to.

any ideas?

Thanks millions,

"XP" wrote:

The following works for me (change parameters and include full path to your db:

Dim oAccess As Object, oDB As Object
Set oAccess = CreateObject("Access.Application")
oAccess.Visible = True
oAccess.OpenCurrentDatabase "MyFullDBPathName.mdb"
oAccess.Run "MyTestMacro", "MyParameter"

HTH

"Souris" wrote:

I need run an Access macro from Excel spreadsheet and pass a paramter from a
cell of the spreadsheet.

Is it possible to have a macro to accept paramter in Access?
If yes, can I pass parameter from excel to access macro?
If yes, any example to do so?

Your information is great appreciated,