VBA - initializing defaults on presentation view?

N

Nicholas Clark

Hi all,

I'm making a little widget for a professor at my campus that allows him to
change to and from pen mode, and change color without having access to a
keyboard or 2-button mouse (he prefers to use only a stylus). I have a few
VBA command buttons set up, and and the way in which I indicate which color
is active is by changing the background color of one of the buttons.

I implemented this with buttons buttons to change to and from pen mode and 4
different color buttons, all of which live on the Slide Master. Each color
button changes the color of the pen pointer, and also changes the background
of the 'pen' command button to reflect which color is active.

What I'd like to know is if there was some way to set a default value for
the background of the command button, which would reload automatically every
time the presentation is viewed (the way I have it implemented now, the
'pen' button remains changed after exiting the presentation). It would be
ideal if there was a way I could initialize everything when the presentation
is first viewed, even if the user doesn't start on slide 1.

Thanks!
-Nicholas

----

This is the VBA code I have in the slide master:

'-------------------------------

Dim on_lastslide
Dim pen_activated

Private Sub penbutton_click()

With SlideShowWindows(1).View

.PointerType = ppSlideShowPointerPen

If pen_activated = 0 Then
.PointerColor.RGB = RGB(Red:=0, Green:=0, Blue:=0)
penbutton.BackColor = &HC0C0C0
pen_activated = 1
Else
pen_activated = 1
End If
End With

End Sub

Sub erasebutton_click()

SlideShowWindows(1).View.EraseDrawing

End Sub

Sub arrowbutton_click()

With SlideShowWindows(1).View
.PointerType = ppSlideShowPointerArrow
End With

End Sub

Sub blackbutton_click()

With SlideShowWindows(1).View
.PointerColor.RGB = RGB(Red:=0, Green:=0, Blue:=0)
penbutton.BackColor = &HC0C0C0
End With

End Sub
Sub redbutton_click()

With SlideShowWindows(1).View
.PointerColor.RGB = RGB(Red:=255, Green:=0, Blue:=0)
penbutton.BackColor = &HC0C0FF
End With

End Sub
Sub greenbutton_click()

With SlideShowWindows(1).View
.PointerColor.RGB = RGB(Red:=0, Green:=255, Blue:=0)
penbutton.BackColor = &HC0FFC0
End With

End Sub
Sub bluebutton_click()

With SlideShowWindows(1).View
.PointerColor.RGB = RGB(Red:=0, Green:=0, Blue:=255)
penbutton.BackColor = &HFFC0C0
End With

End Sub
 
S

Steve Rindsberg

Hi all,

I'm making a little widget for a professor at my campus that allows him to
change to and from pen mode, and change color without having access to a
keyboard or 2-button mouse (he prefers to use only a stylus). I have a few
VBA command buttons set up, and and the way in which I indicate which color
is active is by changing the background color of one of the buttons.

I implemented this with buttons buttons to change to and from pen mode and 4
different color buttons, all of which live on the Slide Master. Each color
button changes the color of the pen pointer, and also changes the background
of the 'pen' command button to reflect which color is active.

What I'd like to know is if there was some way to set a default value for
the background of the command button, which would reload automatically every
time the presentation is viewed (the way I have it implemented now, the
'pen' button remains changed after exiting the presentation). It would be
ideal if there was a way I could initialize everything when the presentation
is first viewed, even if the user doesn't start on slide 1.

I think you'll need to write an addin that implements an event handler. The
event handler can trap the event fired when PPT starts or ends a slide show and
set or reset the button background for you.

Make PPT respond to events
http://www.rdpslides.com/pptfaq/FAQ00004.htm
 
A

Austin Myers

Actually your almost there. You need to place the routine (to set the
background color) in a sub routine. That sub will fire automatically when
you open PPT.


Austin Myers
MS PowerPoint MVP Team

Solutions to Multimedia in PowerPoint www.pfcmedia.com
 
S

Steve Rindsberg

Actually your almost there. You need to place the routine (to set the
background color) in a sub routine. That sub will fire automatically when
you open PPT.

Only if it's in an add-in. Auto_Open subs don't fire otherwise.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top