AutoKeys and function arguments

FuzMic

DataBase Tinker
Local time
Tomorrow, 04:24
Joined
Sep 13, 2006
Messages
744
Hi everybody

I use an {F1} Autokey macro that use the RunCode Action with the argument as = Help(). This Help function in fact has 2 arguments which are public variables eg DirA & StrB that were declared in the Application. When I put them in eg = Help([DirA], [StrB]) and then press F1 key, an error messages states that "Object don't contain the Automation object "DirA". By the way, without the 2 arguments, F1 works.

2 questions

1) How can I make the Autokey {F1} work with the 2 variables?

2) Can I create an Autokey F1 without using a Macro. I tried using VB codes without success.

Any Help appreciated. Thanks!
 
Post the code for your help function including the declarations.
 
Hi Bob

The function is as simple as

Public Function Help(Dir$, Ap$)
MsgBox Dir$ & " " & Ap$
End Function

The declared public vars are

Public DirA as String
Public StrB As String
 
You can't use variables in your function call that way:

= Help([DirA], [StrB])

You would need a wrapper function to use those variables

Code:
Function GetDirA()
   GetDirA = DirA
End Function

Function GetStrB()
   GetStrB = StrB
End Function

And then use

= Help(GetDirA(), GetStrB())
 
Bob, much obliged, variable wrapper works absolutely for macro. :)
 

Users who are viewing this thread

Back
Top Bottom