Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Beginner at VBA

I'm beginning to teach myself VBA using Super-Easy Guide to the
Microsoft Office Excel 2003 Object Model
http://msdn.microsoft.com/library/de.../odc_super.asp

I'm stuck at the bottom of Lesson 4 where they are trying to show me
how to make Excel automatically run a macro when it starts up. The
timesheet macro runs fine by itself but when I put it in he
Private Sub Workbook_Open()
TimeSheet
End Sub
a window pops up that says:
Expected variable or procedure, not module

What am I doing wrong?

--
Bob Simon
remove both "x"s from domain for private replies
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Beginner at VBA

Bob

Have you named the module that holds the "Timesheet" macro "Timesheet"? That
would cause your problems. You cause lots of problems when module names and
macro names are the same.

Good luck.

Ken
Norfolk, Va
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Beginner at VBA

You have probably named the module as TimeSheet, which is the same name as the
TimeSheet macro.

Change one or the other.

The lesson says to name the module TimeSheets(note the "s")

Gord Dibben Excel MVP

On Fri, 03 Dec 2004 16:46:25 -0600, Bob Simon wrote:

I'm beginning to teach myself VBA using Super-Easy Guide to the
Microsoft Office Excel 2003 Object Model
http://msdn.microsoft.com/library/de.../odc_super.asp

I'm stuck at the bottom of Lesson 4 where they are trying to show me
how to make Excel automatically run a macro when it starts up. The
timesheet macro runs fine by itself but when I put it in he
Private Sub Workbook_Open()
TimeSheet
End Sub
a window pops up that says:
Expected variable or procedure, not module

What am I doing wrong?


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Beginner at VBA

That was it, exactly. Thanks!

On Fri, 03 Dec 2004 16:16:59 -0800, Gord Dibben <gorddibbATshawDOTca
wrote:

You have probably named the module as TimeSheet, which is the same name as the
TimeSheet macro.

Change one or the other.

The lesson says to name the module TimeSheets(note the "s")

Gord Dibben Excel MVP

On Fri, 03 Dec 2004 16:46:25 -0600, Bob Simon wrote:

I'm beginning to teach myself VBA using Super-Easy Guide to the
Microsoft Office Excel 2003 Object Model
http://msdn.microsoft.com/library/de.../odc_super.asp

I'm stuck at the bottom of Lesson 4 where they are trying to show me
how to make Excel automatically run a macro when it starts up. The
timesheet macro runs fine by itself but when I put it in he
Private Sub Workbook_Open()
TimeSheet
End Sub
a window pops up that says:
Expected variable or procedure, not module

What am I doing wrong?



--
Bob Simon
remove both "x"s from domain for private replies
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Beginner at VBA

I renamed the module to "timesheets" and it ran fine when I re-started
Excel. However, the macro is still named "timesheet". Shouldn't
Excel automatically rename the macro when I rename the module? In any
case, how do you do this manually?
Bob

On Fri, 03 Dec 2004 16:16:59 -0800, Gord Dibben <gorddibbATshawDOTca
wrote:

You have probably named the module as TimeSheet, which is the same name as the
TimeSheet macro.

Change one or the other.

The lesson says to name the module TimeSheets(note the "s")

Gord Dibben Excel MVP

On Fri, 03 Dec 2004 16:46:25 -0600, Bob Simon wrote:

I'm beginning to teach myself VBA using Super-Easy Guide to the
Microsoft Office Excel 2003 Object Model
http://msdn.microsoft.com/library/de.../odc_super.asp

I'm stuck at the bottom of Lesson 4 where they are trying to show me
how to make Excel automatically run a macro when it starts up. The
timesheet macro runs fine by itself but when I put it in he
Private Sub Workbook_Open()
TimeSheet
End Sub
a window pops up that says:
Expected variable or procedure, not module

What am I doing wrong?



--
Bob Simon
remove both "x"s from domain for private replies


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Beginner at VBA

The point was that the module and the macro should not have the same name.
So no, changing the name of the module should not affect the name of the
macro. The macro is named in the declaration

sub TimeSheet()

end Sub

you would change it (as an example)

Sub MyTimeSheet()

End sub

Now you would have a macro named MyTimeSheet and no longer have a macro
named Timesheet. Not that any code that refers to the timesheet macro would
have to be changed manually as well - excel will not change it. this is not
the case for changing the module name unless you had specifically referred
to the module in your code.

--
Regards,
Tom Ogilvy

"Bob Simon" wrote in message
...
I renamed the module to "timesheets" and it ran fine when I re-started
Excel. However, the macro is still named "timesheet". Shouldn't
Excel automatically rename the macro when I rename the module? In any
case, how do you do this manually?
Bob

On Fri, 03 Dec 2004 16:16:59 -0800, Gord Dibben <gorddibbATshawDOTca
wrote:

You have probably named the module as TimeSheet, which is the same name

as the
TimeSheet macro.

Change one or the other.

The lesson says to name the module TimeSheets(note the "s")

Gord Dibben Excel MVP

On Fri, 03 Dec 2004 16:46:25 -0600, Bob Simon wrote:

I'm beginning to teach myself VBA using Super-Easy Guide to the
Microsoft Office Excel 2003 Object Model


http://msdn.microsoft.com/library/de...n-us/odc_xl200

3_ta/html/odc_super.asp

I'm stuck at the bottom of Lesson 4 where they are trying to show me
how to make Excel automatically run a macro when it starts up. The
timesheet macro runs fine by itself but when I put it in he
Private Sub Workbook_Open()
TimeSheet
End Sub
a window pops up that says:
Expected variable or procedure, not module

What am I doing wrong?



--
Bob Simon
remove both "x"s from domain for private replies



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
Beginner in excel Sarah Excel Discussion (Misc queries) 7 May 28th 07 06:51 PM
Excel Beginner, TSNS Excel Worksheet Functions 3 May 14th 07 03:00 AM
beginner chart abdo Charts and Charting in Excel 0 April 24th 07 09:58 AM
Beginner VBA question light Excel Programming 1 November 10th 04 01:44 PM
A beginner needs help with Excel and VB Mike[_90_] Excel Programming 1 October 13th 04 02:47 AM


All times are GMT +1. The time now is 08:10 PM.

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

About Us

"It's about Microsoft Excel"