![]() |
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 |
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 |
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? |
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 |
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 |
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 |
All times are GMT +1. The time now is 11:03 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com