
By Christopher Lohr
Microsoft Office offers some easy ways to collect feedback from customers and employees. By using Microsoft ActiveX® controls and Microsoft PowerPoint®, you can become the feedback guru you've always wanted to be.
| Applies to |
| Microsoft Office PowerPoint® 2003 |
| Microsoft PowerPoint 2002 |
Have you ever had a booth at a conference or trade show where you wanted to collect feedback, such as basic contact information, from interested visitors? By using ActiveX controls and Microsoft PowerPoint, you can create a simple presentation as a survey and easily collect customer feedback.
Before we start to create the survey, though, let's investigate ActiveX controls a bit closer.
What is an ActiveX control?
An ActiveX control is a graphical object that you can use in your Office documents, workbooks, and presentations to control a predefined set of events. For example, a command button has an event that occurs when the user clicks the button. The event might be to open a browser or another program.
ActiveX controls include check boxes, text boxes, list boxes, option buttons, command buttons, and other controls. You use them to create custom forms, dialog boxes, and even programs. ActiveX controls offer you options to select entry points for submitting data, or buttons to click that run macros, among other actions.
This table shows a few common ActiveX controls.
| Control |
Name |
Description |
 |
Check box |
An option that a user can turn on or off by selecting it. More than one check box can be selected at a time. |
 |
Text box |
A boxed area in which a user can enter or change text. |
 |
List box |
A box that contains a predetermined list of items a user can select from. |
 |
Option button |
A button that a user can select from a group of options. Only one option can be selected at a time. |
 |
Command button |
A button that initiates an action when the user clicks it. |
You can find these ActiveX controls and more in the Control Toolbox (to see the Control Toolbox, click Toolbars on the View menu of most Office programs). Other custom controls—those that come with another application, or those that you've obtained from another source—may be available for use within an Office program. You can find these controls by clicking the More Controls button in the Control Toolbox.
What can I do with an ActiveX control?
ActiveX controls are similar to controls in programming languages such as Microsoft Visual Basic®, and they are the same controls you can add to custom forms in the Visual Basic Editor. When you add an ActiveX control to an Office file, you write macro code that refers to the control. This is as opposed to assigning a macro to run when the control is clicked.
Note If you want a basic overview of macros and how they work, see Using Macros to Speed Up Your Work. If you need an overview of the Visual Basic Editor, see Managing Macros with the Visual Basic Editor.
Let's create a short survey
Now that you know what ActiveX controls are, let's create our survey.
Because PowerPoint provides us with a great way to present information to visitors, we'll create the survey within a presentation. We'll add ActiveX controls to create the feedback elements of the survey. Respondents can use option buttons to answer a question and type in a text box to enter comments.
To add a label and option buttons
- In PowerPoint, insert a new blank slide into your presentation. (On the Formatting toolbar, click New Slide, and then, in the Slide Layout task pane, click Blank as the layout.)
- On the View menu, point to Toolbars, and then click Control Toolbox.
- In the Control Toolbox, click Label, and then click on the blank slide where you want the control (label) to appear.
- Double-click the control to open the Visual Basic Editor. In the Properties dialog box, type Did you like my presentation? in the Caption field.
Notes
- If the Properties dialog box is not displayed when you open the Visual Basic Editor, click Properties Window on the View menu or press F4.
- If you want to change the properties of a control without leaving PowerPoint, click Properties in the Control Toolbox and then make your changes.
- Return to PowerPoint, click Option Button in the Control Toolbox, and then click below the first label (your survey question) to insert the control (option button) into the slide.
- Double-click the control to display the Visual Basic Editor. In the Properties dialog box, type Yes in the Caption field and False in the Value field.
- Return to PowerPoint, click Option Button in the Control Toolbox, and then click below the first option button to insert the second option button into the slide.
- Double-click the control to display the Visual Basic Editor. In the Properties dialog box, type No in the Caption field and False in the Value field. Make sure that the Value field is set to False for both controls so that one of the options isn't selected by default for the survey respondent.
To add a label and a text box
- In the Control Toolbox, click Label, and then click below the two option buttons to insert the new control (label) into the slide.
- Double-click the control to display the Visual Basic Editor. In the Properties dialog box, type Comments: in the Caption field.
- Return to PowerPoint, click Text Box in the Control Toolbox, and then click below the new label to insert the control (text box) into the slide.
Users can use this text box to enter any comments they may have.
To add a command button
- In the Control Toolbox, click Command Button, and then click below the text box to insert the control (command button) into the slide.
- Double-click the control to display the Visual Basic Editor. In the Properties dialog box, type Submit in the Caption field.
Users can click this Submit button when they have completed the survey and want to submit their responses.
To add actions to the ActiveX controls
- Double-click the command button control to display the Visual Basic Editor.
- Set a reference to the Microsoft Scripting Runtime. (On the Tools menu, click References, and then select the Microsoft Scripting Runtime check box.)
- Insert the following code between "Private Sub CommandButton1_Click()" and "End Sub":
' Purpose: Creates a text file and stores the survey results
' in the text file.
' You must set a reference to the Microsoft Scripting Runtime
' (Tools menu, References command, check the Microsoft Scripting
' Runtime box, and then click OK).
Dim objFSO As Scripting.FileSystemObject
Dim objTS As Scripting.TextStream
' Create the text file.
Set objFSO = New Scripting.FileSystemObject
Set objTS = objFSO.OpenTextFile(CurDir & "/Survey_Results.txt", _
ForAppending, True)
' Write the results to the text file and then
' close the file.
objTS.WriteLine "Yes = " & Me.OptionButton1.Value
objTS.WriteLine "No = " & Me.OptionButton2.Value
objTS.WriteLine "Comments = " & Me.TextBox1.Text
objTS.WriteBlankLines 1
objTS.Close
' Thank the user.
MsgBox "Thanks for taking this survey."
' Clear the results for next time.
Me.OptionButton1.Value = False
Me.OptionButton2.Value = False
Me.TextBox1.Text = ""
- After you insert the code, close the Visual Basic Editor and save your presentation.
- If you want to preview your survey, click the Slide Show button in the lower left of the PowerPoint window.
Viewing user feedback
When users click the Submit button you created, a text file is created to store their feedback. The text file is located in the same directory as the presentation. You can view this text file by searching that directory for the file name Survey_Results.txt.
If you've collected feedback but want to discard it or create a new file for feedback, do one of the following:
- Open the text file and delete all the comments.
- Delete the text file. The next time a user enters feedback for your survey, a new text file will be created with the file name Survey_Results.txt.
- Rename the current text file. The next time a user enters feedback for your survey, a new text file will be created with the file name Survey_Results.txt.
Next time
In this column, we set up just one slide. But you can repeat the procedures above for other slides and create a comprehensive survey that you can use as a way to collect feedback at a conference booth, demonstration, or any other scenario that calls for you to gather feedback from customers or employees. For more ideas on how to create a compelling survey in PowerPoint, see Create and distribute a self-running PowerPoint presentation.
In the next Power User Corner column, learn how to get more out of Office features by working with code procedures. Procedures are the main building blocks of macros, which you can record to extend or automate Office documents and programs. Macros must be contained within one or more procedures. For a good overview of macros before then, see Using Macros to Speed Up Your Work.
Keep sending those e-mails!
We look forward to receiving your e-mail at pwruser@microsoft.com. We really want this to be your column, so please send us your comments and favorite handcrafted Office solutions. Remember, we will not be able to feature every Office solution that we receive, we will not have the time to respond to all of your e-mail, and we are not technical support representatives. But we may feature your solution in an upcoming column.
About the author
Christopher Lohr is a technical writer for the Office Help team. In addition to writing Power User Corner columns, Christopher works to improve user interface in Office as a novice UI and Web designer.
If you like this column and want to hear about more fun and useful Office offerings, sign up for our newsletter.