how to attach a macro to a command button

Views:
 
Category: Education
     
 

Presentation Description

First we create two macros - one to insert a new row and the other to input a new name or product. Next we create a new macro that will run the above two macros. We name it 'new product'. You could also call it 'new entry'. The command button is now assigned the 'new product' macro.

Comments

Presentation Transcript

Slide 1: 

Write your data Click on view Select Toolbars Select Control toolbox From the Control Toolbox select a command button Click and drag to draw a command button In the design mode select the button and change the caption Command Button Control Toolbox Command Button Design icon http://www.familycomputerclub.com

Slide 2: 

8. Now you open the Visual Basic Editor by clicking on Tools -Macro-Visual Basic Editor 9. Then click on Insert Module 10. Write the code as shown which has 2 macros a) Insert Line b) InputProduct and a third one called NewProduct that runs the first 2 macros http://www.familycomputerclub.com

Slide 3: 

11. After writing the macro code as shown in the last slide, double click on the command button and write the code as shown 12. Exit the design mode by clicking on the design icon in the control toolbox 12. Clicking on the command button will execute the macros http://www.familycomputerclub.com Watch the videos on our website http://www.familycomputerclub.com