LESSON SUMMARY: Putting what we have learn so far together into a project.

EXERCISE ONE: A PICTURE BUTTON

STEP 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'. [ It will be automatically pasted into your document ]

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
Message = "Enter your Name please."
Title = "InputBox Demo"
Default = "User"
UserName = InputBox(Message, Title, Default)
Message = "The users name is " + UserName + "!"
Response = MsgBox(Message)

STEP 4: Test your code.


EXERCISE TWO EXTENSION:

Once you have it working, fiddle around with different questions and outputs.

The Turtle Example in 'VBA Exercise2.doc' uses an InputBox to good effect, as does the Mental Maths example in 'VBA Exercise3.doc'


VBA TutorNote: This lesson refers to exercises that can be downloaded from here!