From: Renny Bosch on
I have a form on which I can enter a number, and a "Run" button. I would
like to call the procedure indicated by the number, so I have tried to
calculate the procedure name and the name of the module in which that
procedure is found.

I tried various things, such as:

Dim myModule As Module

Set myModule = Application.Modules("Euler" & pn \ 25)
CallByName myModule, "Euler" & pn, VbMethod

On the statement I get error 438, Object doesn't support this property or
method.

When the program stops there (having entered 11 for the number), I find that
myModule correctly resolves to Euler0, which is the name of the module that
contains the Sub Euler11(). So why do I get error 438?

Windows XP fully updated, MS Office 2007, VBA 6.5.





From: Arvin Meyer [MVP] on
You call procedures like this from standard modules. For instance, a module
named:

basUtilities

might have a function called FileExists(strPath As String) As Boolean

which you'd call like:

If FileExists("C:\MyFile.txt") Then
'Do something
End If
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"Renny Bosch" <noname(a)nospam.com> wrote in message
news:OQLpyTNkKHA.2164(a)TK2MSFTNGP02.phx.gbl...
>I have a form on which I can enter a number, and a "Run" button. I would
>like to call the procedure indicated by the number, so I have tried to
>calculate the procedure name and the name of the module in which that
>procedure is found.
>
> I tried various things, such as:
>
> Dim myModule As Module
>
> Set myModule = Application.Modules("Euler" & pn \ 25)
> CallByName myModule, "Euler" & pn, VbMethod
>
> On the statement I get error 438, Object doesn't support this property or
> method.
>
> When the program stops there (having entered 11 for the number), I find
> that myModule correctly resolves to Euler0, which is the name of the
> module that contains the Sub Euler11(). So why do I get error 438?
>
> Windows XP fully updated, MS Office 2007, VBA 6.5.
>
>
>
>
>


From: Gina,ccie cert. and mcse cert. email me on

"Renny Bosch" <noname(a)nospam.com> wrote in message
news:OQLpyTNkKHA.2164(a)TK2MSFTNGP02.phx.gbl...
>I have a form on which I can enter a number, and a "Run" button. I would
>like to call the procedure indicated by the number, so I have tried to
>calculate the procedure name and the name of the module in which that
>procedure is found.
>
> I tried various things, such as:
>
> Dim myModule As Module
>
> Set myModule = Application.Modules("Euler" & pn \ 25)
> CallByName myModule, "Euler" & pn, VbMethod
>
> On the statement I get error 438, Object doesn't support this property or
> method.
>
> When the program stops there (having entered 11 for the number), I find
> that myModule correctly resolves to Euler0, which is the name of the
> module that contains the Sub Euler11(). So why do I get error 438?
>
> Windows XP fully updated, MS Office 2007, VBA 6.5.
>
>
>
>
>

From: Renny Bosch on
Gina, your message didn't show up.

Renny

"Gina,ccie cert. and mcse cert. email me" <gina.1983(a)live.com> wrote in
message news:O7DabFSkKHA.2184(a)TK2MSFTNGP04.phx.gbl...
>
> "Renny Bosch" <noname(a)nospam.com> wrote in message
> news:OQLpyTNkKHA.2164(a)TK2MSFTNGP02.phx.gbl...
>>I have a form on which I can enter a number, and a "Run" button. I would
>>like to call the procedure indicated by the number, so I have tried to
>>calculate the procedure name and the name of the module in which that
>>procedure is found.
>>
>> I tried various things, such as:
>>
>> Dim myModule As Module
>>
>> Set myModule = Application.Modules("Euler" & pn \ 25)
>> CallByName myModule, "Euler" & pn, VbMethod
>>
>> On the statement I get error 438, Object doesn't support this property
>> or method.
>>
>> When the program stops there (having entered 11 for the number), I find
>> that myModule correctly resolves to Euler0, which is the name of the
>> module that contains the Sub Euler11(). So why do I get error 438?
>>
>> Windows XP fully updated, MS Office 2007, VBA 6.5.
>>
>>
>>
>>
>>
>


From: Renny Bosch on
Thank you, Arvin, but in my case the challenge is:

1. The procedure to be called is in a different module than the caller.

2. I don't want to hard-code the procedure name nor the module name. I
want to be able to generate both names in code.

The sample you showed doesn't address either if these issues. If I need to
explain my problem better, please let me know.


"Arvin Meyer [MVP]" <arvinm(a)mvps.invalid> wrote in message
news:%23E6Je6NkKHA.1652(a)TK2MSFTNGP05.phx.gbl...
> You call procedures like this from standard modules. For instance, a
> module named:
>
> basUtilities
>
> might have a function called FileExists(strPath As String) As Boolean
>
> which you'd call like:
>
> If FileExists("C:\MyFile.txt") Then
> 'Do something
> End If
> --
> Arvin Meyer, MCP, MVP
> http://www.datastrat.com
> http://www.mvps.org/access
> http://www.accessmvp.com
>
>
> "Renny Bosch" <noname(a)nospam.com> wrote in message
> news:OQLpyTNkKHA.2164(a)TK2MSFTNGP02.phx.gbl...
>>I have a form on which I can enter a number, and a "Run" button. I would
>>like to call the procedure indicated by the number, so I have tried to
>>calculate the procedure name and the name of the module in which that
>>procedure is found.
>>
>> I tried various things, such as:
>>
>> Dim myModule As Module
>>
>> Set myModule = Application.Modules("Euler" & pn \ 25)
>> CallByName myModule, "Euler" & pn, VbMethod
>>
>> On the statement I get error 438, Object doesn't support this property
>> or method.
>>
>> When the program stops there (having entered 11 for the number), I find
>> that myModule correctly resolves to Euler0, which is the name of the
>> module that contains the Sub Euler11(). So why do I get error 438?
>>
>> Windows XP fully updated, MS Office 2007, VBA 6.5.
>>
>>
>>
>>
>>
>
>