| VBA TUTOR 2007 LESSON FIVE: Having a bit of fun {:) Lesson 4 |
LESSON SUMMARY: Putting what we have learn so far together into a project.EXERCISE ONE: A PICTURE BUTTONSTEP 1: Create a new word document and save it as 'PictureButton_test.doc'.STEP 2: Select 'View ... Toolbars ... Control Toolbox' STEP 3: From the Toolbox select 'Picture'. STEP 4: Use the Format Control from the Right Click menu to set the Wrapping to 'Tight' with a 0.01 mm distance to text. STEP 5: Right click to bring up the action dialog box. Select 'Properties' Enter these values ... BorderStyle - None BackStyle - Transparent BackColor - Windows Background ClipMode - Stretch Picture - Select a Graphic file to display as the control from your clip art. (Your ClipArt is in 'C:\Program Files\Microsoft Office\Clipart\???') STEP 6: Size the control to suit. STEP 7: Double click on the button to bring up the 'Commandbutton' code editor and copy and paste the following into its click procedure ... Response = MsgBox("Name of your picture")EXERCISE ONE EXTENSION:You could create a simple language program using your clipart, as shown by the Examples in 'VBA Exercise2.doc'.EXERCISE TWO: GETTING USER INPUT.STEP 1: Create a new word document and save it as 'InputBox_test.doc'.STEP 2: Paste a CommandButton into the document. STEP 3: Enter the following code into the script for a CommandButton. Dim Message, Title, Default, UserName, Response
STEP 4: Test your code. |
Lesson 4 © 2007 Gary Radley |