Sunteți pe pagina 1din 4

4/7/2015

Design a VBA User Form - Option Buttons, Command Buttons, Picture Boxes

Excel VBA Programming


Home
Getting Started
8 part section >>
VBA Programming Variables
6 Part Section >>
Conditional Logic
9 part section >>
Strings and String Functions
8 Part Section >>
Programming Loops
4 Part Section >>
Programming Arrays
4 Part Section >>
Subs and Functions
6 Part Section >>
Excel VBA and Text Files
2 Part Section >>
Excel VBA and User Forms
5 part section >>
An Excel Picture Viewer Project
Excel Picture Viewer
Design the User Form
Option and Command Buttons
Add New Photo Tab
Form Initialize Event
Get Textbox data
VBA Option Button Code
ImageBox VBA Code
Next and Previous Buttons
Add New Photo Button
Save New Image
Copy an Image with Excel VBA
Excel VBA and Charts
4 part section >>
A TreeView Project
A 6 part section >>

http://www.homeandlearn.org/option_buttons_and_command_buttons.html

1/4

4/7/2015

Design a VBA User Form - Option Buttons, Command Buttons, Picture Boxes

Excel Data
Analysis
5 Ways to
Enhance
Excel Data.
Download
the Free
Whitepaper!

Option Buttons and Command Buttons


Ongoing tutorial - First part is here: Part One

To add the YES and NO option buttons, locate the Option Button control in the toolbox:

Draw two of them on the form. Set the following Properties for your two buttons:
OptionButton1
Caption: Yes
Height: 18
Width: 50
Left: 102
Top: 258
OptionButton2
Caption: No
http://www.homeandlearn.org/option_buttons_and_command_buttons.html

2/4

4/7/2015

Design a VBA User Form - Option Buttons, Command Buttons, Picture Boxes

Height: 18
Width: 50
Left: 162
Top: 258
To add the picture box, locate the Image control in the toolbox:

Draw one on your form and set the following properties for it:
Height: 210
Width: 288
Left: 258
Top: 66

Excel Data Analysis


5 Ways to Enhance Excel Data. Download the Free Whitepaper!

Adding Command buttons to a Form


Finally, we need to add the three command buttons. So draw three of them on the form. Set up the
following properties for each button:
CommandButton1
Name: cmdLoad
Caption: Load Image Information
Height: 36
Width: 190
Left: 24
Top: 6
CommandButton2
Name: cmdBack
Caption: Previous Photo
Height: 30
Width: 114
Left: 258
Top: 312
CommandButton3
Name: cmdNext
Caption: Next Photo
Height: 30
Width: 108
Left: 438
Top: 312
And that's all the controls for View Photos page. In the next lesson, you'll design the Add New Photo
tab of the form.
http://www.homeandlearn.org/option_buttons_and_command_buttons.html

3/4

4/7/2015

Design a VBA User Form - Option Buttons, Command Buttons, Picture Boxes

The Add New Photo Tab >


Lots more free online course here on our main Home and Learn site
All course material copyright Ken Carney

http://www.homeandlearn.org/option_buttons_and_command_buttons.html

4/4

S-ar putea să vă placă și