ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Module call (https://www.excelbanter.com/excel-programming/372074-module-call.html)

RJH

Module call
 
Sometimes when I call a routine from a module I can just use the routine
name:
Sub Routine_Clcik()
Routine1
End Sub

Other times I get the error: Compile error, Expected procedure, not variable
and I have to use the module name:
Sub Routine_Click()
[Module1].Rouine1
End Sub

Why is this?

Thanks!
RJH



Bob Phillips

Module call
 
If the procedure is in a class module associated with one of the worksheets
or the workbook, you have to precede it with the class (module) name.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"RJH" wrote in message
...
Sometimes when I call a routine from a module I can just use the routine
name:
Sub Routine_Clcik()
Routine1
End Sub

Other times I get the error: Compile error, Expected procedure, not

variable
and I have to use the module name:
Sub Routine_Click()
[Module1].Rouine1
End Sub

Why is this?

Thanks!
RJH





RJH

Module call
 
These aren't Class Module calls. They are calls from ordinary modules, for
example: Module1, Module2, etc..

Thanks!

RJH

"Bob Phillips" wrote in message
...
If the procedure is in a class module associated with one of the
worksheets
or the workbook, you have to precede it with the class (module) name.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"RJH" wrote in message
...
Sometimes when I call a routine from a module I can just use the routine
name:
Sub Routine_Clcik()
Routine1
End Sub

Other times I get the error: Compile error, Expected procedure, not

variable
and I have to use the module name:
Sub Routine_Click()
[Module1].Rouine1
End Sub

Why is this?

Thanks!
RJH







Bob Phillips

Module call
 
Are you using the same sub name in multiple modules?

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"RJH" wrote in message
...
These aren't Class Module calls. They are calls from ordinary modules,

for
example: Module1, Module2, etc..

Thanks!

RJH

"Bob Phillips" wrote in message
...
If the procedure is in a class module associated with one of the
worksheets
or the workbook, you have to precede it with the class (module) name.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"RJH" wrote in message
...
Sometimes when I call a routine from a module I can just use the

routine
name:
Sub Routine_Clcik()
Routine1
End Sub

Other times I get the error: Compile error, Expected procedure, not

variable
and I have to use the module name:
Sub Routine_Click()
[Module1].Rouine1
End Sub

Why is this?

Thanks!
RJH









RJH

Module call
 
No. Unique sub names in each module.

RJH


"Bob Phillips" wrote in message
...
Are you using the same sub name in multiple modules?

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"RJH" wrote in message
...
These aren't Class Module calls. They are calls from ordinary modules,

for
example: Module1, Module2, etc..

Thanks!

RJH

"Bob Phillips" wrote in message
...
If the procedure is in a class module associated with one of the
worksheets
or the workbook, you have to precede it with the class (module) name.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"RJH" wrote in message
...
Sometimes when I call a routine from a module I can just use the

routine
name:
Sub Routine_Clcik()
Routine1
End Sub

Other times I get the error: Compile error, Expected procedure, not
variable
and I have to use the module name:
Sub Routine_Click()
[Module1].Rouine1
End Sub

Why is this?

Thanks!
RJH












All times are GMT +1. The time now is 01:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com