Saturday, December 17, 2011

15-. Making a Program in Visual Basic Using PowerPoint Such that VB Programs

15. Making a Program in Visual Basic Using PowerPoint Such that VB Programs Can Run in the Macintosh Or IBM Compatible Environment by Joel Stretesky
Click here for IBM compatible PowerPoint, or click here for the Mac Compatible PowerPoint. These PowerPoint presentations allow the user to take a Black Hole Quiz which has a embedded Visual Basic Program in it.  First open the Black Hole Quiz PowerPoint. On a Mac a message come up saying something like do you want to enable a Macro, say you do. In the IBM environment you might get a message that says macros have been disabled, click on options to the right of this message. Select you want to enable the content. The following dialog window may come up automatically if you are running Office 2008 in the IBM compatible environment:
Security Options
The reason this message is that viruses or security problems are sometimes carried in Office Macros. However, it is the macro that allows you to call for the form in the underlying Visual Basic programming engine. Run the PowerPoint by going to slide show and view show as shown below.
View Show
To get into the Visual Basic Programming engine go to View, Toolbars and select Visual Basic as shown below
Select Visual Basic
Drag and drop your toolbar to your menu. Click on the Visual Basic Icon in the toolbar as shown below. (In PowerPoint 2008 go to View, Macros, type in a name of the macro black hole, and click create and you will go directly into Microsoft Visual Basic.)
Visual Basic Editor
The Office 2003 Studio Environment looks as follows. Expand and click on UserForm1 as shown below to bring up the program's Form.
Click on UserForm1
Here the program can be designed as you wish with the limited controls which you have available as shown below:
Display of the form
When you have made the program exactly how you like it, go to save as shown below, saving the power point and the VB code in it (i.e. black_hole_quiz_two_IBM.ppt).
Save the program
The difference between the Mac and IBM compatible PowerPoints is simple. If you double click on Module1 as shown below...
Click on Module1
you will go into the modules code window. If you are programming in the IBM Environment make sure the the 3 lines are commented out as shown below with apostrophes. Do this for both Module 1 and Module 2. You can now program in Visual Basic in the IBM environment. This has already been done for you in the Black Hole PowerPoint for IBM compatibles.
Sub quiz()
'*********************************
'these three lines allow program to run on a Mac
'For Each Control In UserForm1.Controls
'Control.Visible = True
'Next Control

'**************************************

'Code Omitted
If you are programming in the Mac Environment uncomment the 3 lines as shown below with apostrophes. Do this for both Module 1 and Module 2. You can now program in Visual Basic in the Mac environment. This has already been done for you in the Black Hole PowerPoint.
Sub quiz()
'*********************************
'this three lines allow program to run on a mac
For Each Control In UserForm1.Controls
Control.Visible = True
Next Control

'**************************************

'Code Omitted

0 comments:

Post a Comment