Some pointers that MIGHT help...
A new command button can be added into PowerPoint.
VB Code:
Sub Add_RegFile_Button()
' First delete the added buttons
Set Buttons = CommandBars("Standard").Controls
For Each Control In Buttons
If (Control.BuiltIn = False) _
And Control.Caption = "Your Button Text" Then
Control.Delete
End If
Next Control
Set newItem = _
CommandBars("Standard").Controls.Add(Type:=msoControlButton)
With newItem
.BeginGroup = True
.Caption = "Your Button Text"
.FaceId = 455
.OnAction = "YourProgName"
End With
End Sub
This macro is in two parts – the first part deletes any button with the same name that you are about to add. This “delete first” allows you to run the macro as often as you like, without new buttons being added each time.
The second part adds the new button in to the “Standard” command bar.
· The .OnAction calls another sub routine VBA macro.
· The .Caption is what the user sees when they hover the mouse over the button.
· The .FaceID is the number of an icon to appear on the button. Getting your own icon on the button might be possible, but it does not seem to be documented as to how to do it!
See the MS Office 2000 Visual Basic Programmers Guide for more details.
In order for PowerPoint to call an external application, a VBA macro needs to be written. Typically the name of the subroutine of this macro is the one specified in the .OnAction described above.
VB Code:
Sub YourSub()
TempDoc = Environ("Temp") & "\Presentation.PPT"
ActivePresentation.SaveCopyAs TempDoc
RegFiler = GetSetting("YourRegistry", "Startup", "Location", "")
AppName = RegFiler & " " & Chr(34) & TempDoc & Chr(34)
rc = Shell(AppName, vbNormalFocus)
End Sub
This macro performs three actions:
· Save a copy of the current work book to a temporary location and temporary name. The location of the Temp folder is found from the Environment variables on the PC.
· Identify the name of the application to be launched from the Registry using the GetSetting command.
· Launch the required application, using the name of the saved document as a parameter enclosed in “” (the Chr(34) is a double quote mark).