Sams Teach Yourself Visual Basic 6 in 24 Hours
- Table of Contents
- Copyright
- About the Author
- Acknowledgments
- Introduction
- Who Should Read This Book
- What This Book Will Do for You
- Can This Book Really Teach Visual Basic in 24 Hours?
- What You Need
- Files on the Visual Basic Distribution CD-ROM
- Conventions Used in This Book
- Enough! Time Is Ticking!
- Part I: Introducing Visual Basic
- Hour 1. Visual Basic at Work
- Hour 2.Analyzing Visual Basic Programs
- Hour 3.Controls and Properties
- Hour 4.Examining Labels, Buttons, and Text Boxes
- Part II: Coding the Details
- Hour 5.Putting Code into Visual Basic
- Hour 6.Message and Input Boxes
- Hour 7.Making Decisions
- Hour 8.Visual Basic Looping
- Part III:Putting Code to Work
- Hour 9.Combining Code and Controls
- Hour 10.List Boxes and Data Lists
- Hour 11.Additional Controls
- Hour 12.Dialog Box Basics
- Part IV:Programming with Data
- Hour 13.Modular Programming
- Hour 14.Built-In Functions Save Time
- Hour 15.Visual Basic Database Basics
- Hour 16.Printing with Visual Basic
- Part V:Sprucing Up Programs
- Hour 17.Menus and Visual Basic
- Hour 18.The Graphic Image Controls
- Hour 19.Toolbars and More Graphics
- Hour 20.Writing Correct Applications
- Part VI:Advancing Visual Basic Applications
- Hour 21.Visual Basic and ActiveX
- Hour 22.Object Basics
- Hour 23.Distributing Your Applications
- Hour 24.Online Visual Basic
- Part VII:Appendixes
- Appendix A.Operator Precedence
- Appendix B.Answers
- Appendix C.Using the CD-ROM
ActiveX Documents
An ActiveX container is an application, such as Internet Explorer, that can display and activate ActiveX documents.
ActiveX documents are difficult objects to create from scratch. An ActiveX document must be contained within an ActiveX container application such as Internet Explorer. If you have Internet Explorer, try this: Start Internet Explorer but don't log on to the Internet as you might normally do. Open a Word document. If you've never tried this, you might be surprised at the results. Internet Explorer can display the Word document, formatted completely, and you can edit the document as if it were shown inside Word. Figure 21.6 shows such a document embedded inside Internet Explorer.
Figure 21.6 Internet Explorer is an ActiveX container program.
You have access to Word's menus inside the ActiveX container. You can also right-click over the text to see Word's pop-up menu. Misspelled, foreign, and abbreviated words are underlined as possible misspellings, and you can highlight and format text by pressing Word's typical formatting keystrokes (such as Ctrl+B to boldface text).
When an ActiveX container activates an ActiveX document, all the document's usual controls and features become available.
A Word document is an ActiveX document. An ActiveX container such as Internet Explorer can display and let you work within the ActiveX document. ActiveX documents are going to become more important as the Internet becomes more important. The more you work within a Web browser, the more likely it will be that you'll want to view data from another source, such as a Word document. When you're working with an ActiveX document, you don't have to start Word to read the document.
Visual Basic's Professional and Enterprise Editions include a wizard that converts your forms to ActiveX documents. Although the wizard cannot convert complete applications to ActiveX documents, you can convert forms with all their features.
To run the wizard, called the VB ActiveX Document Migration Wizard, you must add the wizard to your Add-Ins menu by following these steps:
- Select Add-Ins | Add-In Manager to open the Add-In Manager dialog box (see Figure 21.7).
Figure 21.7 Adding the wizard to the Add-In Manager.
- Select the entry labeled VB 6 ActiveX Doc Migration Wizard, check the Loaded/Unloaded check box, and close the dialog box. The wizard now appears on your Add-Ins menu when you display the menu.
- Open the application that contains the form you want to convert to an ActiveX document.
- Select Add-Ins | ActiveX Document Migration Wizard to start the wizard.
- After you click Next at the introductory dialog box, select the form you want to convert to an ActiveX document.
- Generally, you'll select all the defaults, so click Finish to complete the migration.
- Close the ending dialog boxes. Run the application to create the ActiveX document file.
Do you remember the animated form with the happy face moving up the form from Hour 18, "The Graphic Image Controls" ? If so, you'll enjoy seeing it again, only this time as the ActiveX document in Figure 21.8.
Figure 21.8 You can convert any form to an ActiveX document!
Summary | Next Section

Account Sign In
View your cart