Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Beginner in excel | Excel Discussion (Misc queries) | |||
Excel Beginner, | Excel Worksheet Functions | |||
beginner chart | Charts and Charting in Excel | |||
Beginner VBA question | Excel Programming | |||
A beginner needs help with Excel and VB | Excel Programming |