Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Calling a procedure in a procedure

Hi Alex,

I could replicate your problem if I had a module named Summary.

If this is your situation, rename either the sub or the module.

---
Regards,
Norman



"Alex" wrote in message
...
I'm getting the following error..

Compile Error:

Expected variable or procedure, not module

When I run my macro and it shows this part of my code....

Finish = MsgBox("Click YES to finish report, Click NO to end." & Chr(13) &

_
"Rerun the M & S Macro if you need to add more reports", vbYesNo +
vbInformation)
If Finish = vbYes Then
Summary '<----- THIS PART IS HIGHLIGHTED ON ERROR
Exit Sub
Else
MsgBox "Let me know if this macro has helped you."
End If

BTW I do have a variable for this though it's not here.

Any ideas why the error?



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default Calling a procedure in a procedure

There really is nothing to the procedure SUMMARY all it is a actual recorded
macro. Nothing has been edited aside from the bloated code.


"Norman Jones" wrote:

Hi Alex,

I could replicate your problem if I had a module named Summary.

If this is your situation, rename either the sub or the module.

---
Regards,
Norman



"Alex" wrote in message
...
I'm getting the following error..

Compile Error:

Expected variable or procedure, not module

When I run my macro and it shows this part of my code....

Finish = MsgBox("Click YES to finish report, Click NO to end." & Chr(13) &

_
"Rerun the M & S Macro if you need to add more reports", vbYesNo +
vbInformation)
If Finish = vbYes Then
Summary '<----- THIS PART IS HIGHLIGHTED ON ERROR
Exit Sub
Else
MsgBox "Let me know if this macro has helped you."
End If

BTW I do have a variable for this though it's not here.

Any ideas why the error?




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Calling a procedure in a procedure

Ok, starting from the othe end, what happens if you rename your called sub
as (say) MYSummary?

Obviously, change Summary to MySummary in your calling sub!

---
Regards,
Norman



"Alex" wrote in message
...
There really is nothing to the procedure SUMMARY all it is a actual

recorded
macro. Nothing has been edited aside from the bloated code.


"Norman Jones" wrote:

Hi Alex,

I could replicate your problem if I had a module named Summary.

If this is your situation, rename either the sub or the module.

---
Regards,
Norman



"Alex" wrote in message
...
I'm getting the following error..

Compile Error:

Expected variable or procedure, not module

When I run my macro and it shows this part of my code....

Finish = MsgBox("Click YES to finish report, Click NO to end." &

Chr(13) &
_
"Rerun the M & S Macro if you need to add more reports", vbYesNo +
vbInformation)
If Finish = vbYes Then
Summary '<----- THIS PART IS HIGHLIGHTED ON

ERROR
Exit Sub
Else
MsgBox "Let me know if this macro has helped you."
End If

BTW I do have a variable for this though it's not here.

Any ideas why the error?






  #4   Report Post  
Posted to microsoft.public.excel.programming
N10 N10 is offline
external usenet poster
 
Posts: 141
Default Calling a procedure in a procedure


I guess that fixed It ! ?

N10 !
"Norman Jones" wrote in message
...
Ok, starting from the othe end, what happens if you rename your called sub
as (say) MYSummary?

Obviously, change Summary to MySummary in your calling sub!

---
Regards,
Norman



"Alex" wrote in message
...
There really is nothing to the procedure SUMMARY all it is a actual

recorded
macro. Nothing has been edited aside from the bloated code.


"Norman Jones" wrote:

Hi Alex,

I could replicate your problem if I had a module named Summary.

If this is your situation, rename either the sub or the module.

---
Regards,
Norman



"Alex" wrote in message
...
I'm getting the following error..

Compile Error:

Expected variable or procedure, not module

When I run my macro and it shows this part of my code....

Finish = MsgBox("Click YES to finish report, Click NO to end." &

Chr(13) &
_
"Rerun the M & S Macro if you need to add more reports", vbYesNo

+
vbInformation)
If Finish = vbYes Then
Summary '<----- THIS PART IS HIGHLIGHTED ON

ERROR
Exit Sub
Else
MsgBox "Let me know if this macro has helped you."
End If

BTW I do have a variable for this though it's not here.

Any ideas why the error?







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Calling a procedure in a procedure

Hi Alex,

What are the names of the modules in this project?

Where are the two procedures stored?

---
Regards,
Norman



"Alex" wrote in message
...
Here's what i get when I press F1 (HELP)...

Expected variable or procedure, not module


There is no variable or procedure by this name in the current scope, but
there is a module by this name. This error has the following cause and
solution:

The name of a module is used as a variable or procedure.
Check the spelling of the variable or procedure name, and make sure the

name
you want to refer to isn't private to another module. A module name can be

a
qualifier, but can't stand alone.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Calling a procedure in a procedure

I needed to have the SUBs in the same Module for the procedure
to procedure
call to work.


Generally speaking, this is not true. As long as the procedures
are not marked as Private, they can reside in separate modules.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Alex" wrote in message
...
I figured it out... somewhat... I have 2 different

Modules....And that was
the problem....

I needed to have the SUBs in the same Module for the procedure

to procedure
call to work.

DOH!


"Norman Jones" wrote:

Hi Alex,

What are the names of the modules in this project?

Where are the two procedures stored?

---
Regards,
Norman



"Alex" wrote in message
...
Here's what i get when I press F1 (HELP)...

Expected variable or procedure, not module


There is no variable or procedure by this name in the

current scope, but
there is a module by this name. This error has the

following cause and
solution:

The name of a module is used as a variable or procedure.
Check the spelling of the variable or procedure name, and

make sure the
name
you want to refer to isn't private to another module. A

module name can be
a
qualifier, but can't stand alone.






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Calling a procedure in a procedure

Hi Alex,

As Chip points out in the adjacent post, unless the called sub is marked as
Private, the fact that the two subs are in different modules should not pose
any problem.

Further, if the subs were marked as Private, I would expect an error message
akin to:

Sub or Function not defined

In your described scenario I would not expect your reported error.

--
Regards,
Norman



"Alex" wrote in message
...
I figured it out... somewhat... I have 2 different Modules....And that was
the problem....

I needed to have the SUBs in the same Module for the procedure to

procedure
call to work.

DOH!


"Norman Jones" wrote:

Hi Alex,

What are the names of the modules in this project?

Where are the two procedures stored?

---
Regards,
Norman



"Alex" wrote in message
...
Here's what i get when I press F1 (HELP)...

Expected variable or procedure, not module


There is no variable or procedure by this name in the current scope,

but
there is a module by this name. This error has the following cause and
solution:

The name of a module is used as a variable or procedure.
Check the spelling of the variable or procedure name, and make sure

the
name
you want to refer to isn't private to another module. A module name

can be
a
qualifier, but can't stand alone.






  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Calling a procedure in a procedure

Hi Alex,

Would having the module and the sub the same name affect it?


Indeed!

In my first response to you I said:

Hi Alex,


I could replicate your problem if I had a module named Summary.


If this is your situation, rename either the sub or the module.




---
Regards,
Norman



"Alex" wrote in message
...
hhmmm...

By default all subs are public right?

Would having the module and the sub the same name affect it?


"Norman Jones" wrote:

Hi Alex,

As Chip points out in the adjacent post, unless the called sub is marked

as
Private, the fact that the two subs are in different modules should not

pose
any problem.

Further, if the subs were marked as Private, I would expect an error

message
akin to:

Sub or Function not defined

In your described scenario I would not expect your reported error.

--
Regards,
Norman



"Alex" wrote in message
...
I figured it out... somewhat... I have 2 different Modules....And that

was
the problem....

I needed to have the SUBs in the same Module for the procedure to

procedure
call to work.

DOH!


"Norman Jones" wrote:

Hi Alex,

What are the names of the modules in this project?

Where are the two procedures stored?

---
Regards,
Norman



"Alex" wrote in message
...
Here's what i get when I press F1 (HELP)...

Expected variable or procedure, not module


There is no variable or procedure by this name in the current

scope,
but
there is a module by this name. This error has the following cause

and
solution:

The name of a module is used as a variable or procedure.
Check the spelling of the variable or procedure name, and make

sure
the
name
you want to refer to isn't private to another module. A module

name
can be
a
qualifier, but can't stand alone.









  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Calling a procedure in a procedure

By default all subs are public right?

Yes.

Would having the module and the sub the same name affect it?


Yes. A module and a procedure (in any module) should never share
the same name.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Alex" wrote in message
...
hhmmm...

By default all subs are public right?

Would having the module and the sub the same name affect it?


"Norman Jones" wrote:

Hi Alex,

As Chip points out in the adjacent post, unless the called

sub is marked as
Private, the fact that the two subs are in different modules

should not pose
any problem.

Further, if the subs were marked as Private, I would expect

an error message
akin to:

Sub or Function not defined

In your described scenario I would not expect your reported

error.

--
Regards,
Norman



"Alex" wrote in message
...
I figured it out... somewhat... I have 2 different

Modules....And that was
the problem....

I needed to have the SUBs in the same Module for the

procedure to
procedure
call to work.

DOH!


"Norman Jones" wrote:

Hi Alex,

What are the names of the modules in this project?

Where are the two procedures stored?

---
Regards,
Norman



"Alex" wrote in message

...
Here's what i get when I press F1 (HELP)...

Expected variable or procedure, not module


There is no variable or procedure by this name in the

current scope,
but
there is a module by this name. This error has the

following cause and
solution:

The name of a module is used as a variable or

procedure.
Check the spelling of the variable or procedure name,

and make sure
the
name
you want to refer to isn't private to another module. A

module name
can be
a
qualifier, but can't stand alone.









Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling procedure when leaving cell jeffP Excel Worksheet Functions 5 February 9th 06 08:59 AM
Calling a procedure in a procedure N10 Excel Programming 2 August 18th 04 12:49 AM
Calling a procedure in a procedure Don Guillett[_4_] Excel Programming 1 August 17th 04 11:31 PM
Calling a .Net Procedure from a Macro Scott Eguires Excel Programming 0 December 10th 03 10:35 PM
Calling a Custom Function within a Procedure [email protected] Excel Programming 1 November 16th 03 03:51 AM


All times are GMT +1. The time now is 09:34 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"