VBA Question

  • Thread starter Thread starter Jeff
  • Start date Start date
J

Jeff

I have written a VBA Panel with one of the buttons being a page upand
page down button using the following code


Private Sub CommandButton26_Click()
On Error Resume Next
With ActiveWindow.View
Call .GotoSlide(.Slide.SlideIndex + 1)
End With
End Sub

The code works in the slide view but not the slide master view. What
am I missing?
 
What would you expect it to do in Master view?
(There are no slides to goto in this view)
 
I have written a VBA Panel with one of the buttons being a page upand
page down button using the following code


Private Sub CommandButton26_Click()
On Error Resume Next
With ActiveWindow.View
Call .GotoSlide(.Slide.SlideIndex + 1)
End With
End Sub

The code works in the slide view but not the slide master view. What
am I missing?

As John said, you'll have to explain a little better what you are trying
to do. Among John and Steve and me, I'll bet we could solve just about
any of your VBA problems (mostly John and Steve), but we can't help if
we don't know what you want to do. Do you want to:

(1) Have this work in Slide Show View?
(2) Have this work in Master view by jumping out of master view and
jumping to the slide?

Perhaps, you want something like:


With ActivePresentation.SlideShowWindow.View
.GotoSlide .Slide.SlideIndex + 1
End With

This is a version of your code that will work in Slide Show View, which
seems like what you want because you seem to be attaching this to a
button, which means you want to click it, and that usually happens in
Slide Show view.

--David

--
David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
Microsoft PowerPoint MVP
Associate Professor, Loyola University Maryland
 
I will try to make it clearer and I appreciate the help .

I seemed to be asked to make a lot of powerpoints so I have created a
custom userform with multiple command buttons the do different
functions (position shapes, change colors etc). An example would be
to nudge a picture left or right by a set amounts. Two command buttons
are page up and another a page down. It is convenient to have them
there because it means I can scroll through the presentation with the
mouse to make changes on each slide. Otherwise I have to use the
keyboard and the mouse

The code I wrote works on the slides but if I wan to make the changes
to multiple slide masters the command button page up and down keys do
not work. The is no "GotoSlideMaster" function
 
Try using sendkeys to simulate the keypress (here the up down arrows)

Private Sub CommandButton1_Click()
ActiveWindow.Panes(1).Activate
SendKeys "{UP}"
End Sub

Private Sub CommandButton2_Click()
ActiveWindow.Panes(1).Activate
SendKeys "{DOWN}"
End Sub

NOTE the form will have to be NON modal I think for this to work

UserFormx.Show(0)
--
john ATSIGN PPTAlchemy.co.uk

Free PPT Hints, Tips and Tutorials
http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html
 
Back
Top