Module call

R

RJH

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
 
B

Bob Phillips

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)
 
R

RJH

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

Thanks!

RJH

Bob Phillips said:
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 said:
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
 
B

Bob Phillips

Are you using the same sub name in multiple modules?

--
HTH

Bob Phillips

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

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

Thanks!

RJH

Bob Phillips said:
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 said:
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
 
R

RJH

No. Unique sub names in each module.

RJH


Bob Phillips said:
Are you using the same sub name in multiple modules?

--
HTH

Bob Phillips

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

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

Thanks!

RJH

Bob Phillips said:
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)

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top