Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I view/edit code on Excel 2003 Worksheet Command Button
I do not remember how I access the code behind my Command Button on my
worksheet. I am using Excel 2003. I have searched in ToolsMacros, Sheet1View Code without success. I know that in Excel 2007 you have to go in the Developer tab, but I am using 2003. Help appreciated. J.P. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I view/edit code on Excel 2003 Worksheet Command Button
You can rightclick on the worksheet tab and select View Code.
You'll be in the sheet module for that worksheet. On 11/01/2010 16:24, u473 wrote: I do not remember how I access the code behind my Command Button on my worksheet. I am using Excel 2003. I have searched in ToolsMacros, Sheet1View Code without success. I know that in Excel 2007 you have to go in the Developer tab, but I am using 2003. Help appreciated. J.P. -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I view/edit code on Excel 2003 Worksheet Command Button
Thank you for your answer, but I did that before and I saw the codes
associated to that worksheet, but nowhere do I see a CommandButtonClick() code. I do not know where else to look |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I view/edit code on Excel 2003 Worksheet Command Button
The commandbutton is placed on the worksheet, right?
If yes, then the code associated with that commandbutton will be in that sheet's module. But maybe you're not using commandbuttons from the control toolbox toolbar? Maybe you're using buttons from the Forms toolbar??? If that's the case, then the code should be in a general module -- not behind a worksheet. ======= Another way to get to the sheet module (where the code for the commandbutton will be). Show the control toolbox toolbar. Click on the Design mode icon. Doubleclick your commandbutton. You should be in that sheet's code module and directly in the commmandbutton1_click() procedure. On 11/01/2010 17:40, u473 wrote: Thank you for your answer, but I did that before and I saw the codes associated to that worksheet, but nowhere do I see a CommandButtonClick() code. I do not know where else to look -- Dave Peterson |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I view/edit code on Excel 2003 Worksheet Command Button
Issue not resolved but I learned something from your previous post and
from the following Contexture.com article on the subject. ,,,,,,,,,,,,,,,,,,,,,, 3. Buttons to Run Excel Macros When a button is drawn onto a sheet the assign macro is not displayed. When right-clicking on the button the "Assign Macro" context menu item is not present. There are buttons from the Forms toolbar and there are buttons from the Control Toolbox. If "Assign Macro" is not an option then it's from the Control Toolbox. Choose "View code" and call your macro from it like this: Private Sub CommandButton1_Click() Call Macro1 End Sub ....................... So I created a simple worksheet with a simple macro, which worked then I created a button from the button icon on my menu toolbar (not from the toolbox) Then I right-clicked my button to assign my macro, and it worked fine. But I could not find anywhere the commmandbutton1_click() procedure, whether in the General Module or the Worksheet. As you guessed, I was not using the commandbuttons from the control toolbox toolbar, but using buttons from the Forms toolbar??? So I created another button for the same macro using the control toolbox toolbar. When I right-clicked it, I could see the View Code and place my Call in the CommandButton1_Click() and it worked and I am satisfied. Lesson Learned. However, I still would be curious on how to access the code behind a button created from the Forms Toolbar. Thank you for your help. J.P. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I view/edit code on Excel 2003 Worksheet Command Button
After assigning a macro to the Forms button, right-click on the button and
"Assign Macro" Macro dialog will open with the assigned macro name highlighted. Click on "Edit" to see the code. Gord Dibben MS Excel MVP On Tue, 2 Nov 2010 14:49:27 -0700 (PDT), u473 wrote: However, I still would be curious on how to access the code behind a button created from the Forms Toolbar. Thank you for your help. J.P. |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I view/edit code on Excel 2003 Worksheet Command Button
Ok, so you are telling me that from a Forms button I cannot expect to
see a CommandButton1_Click() procedure. Lesson Learned. Thank you for your help. J.P |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I view/edit code on Excel 2003 Worksheet Command Button
The code for the buttons from the Forms toolbar will be in a General module.
The macro could be named any legal name. You could call it "commandbutton1_click" if you wanted -- even if the button were named "hitherefromJP". But I wouldn't do that. It may not confuse excel, but it would confuse me and it may confuse whoever owns the workbook after I share it with them. On 11/03/2010 11:10, u473 wrote: Ok, so you are telling me that from a Forms button I cannot expect to see a CommandButton1_Click() procedure. Lesson Learned. Thank you for your help. J.P -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Edit text in a Command button | Excel Programming | |||
Command button to toggle worksheet event code on / off? | Excel Discussion (Misc queries) | |||
How do I view and edit the source code for a Chart in Excel 2003? | Charts and Charting in Excel | |||
View / Edit Excel 2003 files in Excel 2000 | Excel Discussion (Misc queries) | |||
edit command button | Excel Programming |