VBA question

B

Benjamin

I am trying to get a scrollbar to work during a presentation. I am currently
using this code:

Public WithEvents PPTEvent As Application

Private Sub Scroll_Change()
image.Top = (Scroll.Value * -1)
'refreshes slide
Dim lSlideIndex As Long
lSlideIndex = SlideShowWindows(1).View.CurrentShowPosition
SlideShowWindows(1).View.GotoSlide lSlideIndex
End Sub

This code is working however it is making direct changes to the slide, so
when the user ends the presentation he/she is asked if they want to save
changes. If they say no then the scrollbar won't work again EVER on that
slide (i don't know why). But what I am trying to do is have the slide
display the same thing ever time someone goes to it and allow them to scroll
a picture and then when they leave the slide have it go back to the way it
was originally. Like having the scrollbar value be zero. And I don't want
them to be prompted with a save dialog box at the end of the show.

This is the first time I have ever used VBA code in PPT so I don't exactly
know what is going on. I think possible solutions may be found in changing
the first line of code "Public WithEvents PPTEvent As Application" It seems
that the As Application may be causing a problem, but like I said I really am
not understanding how this line of code works or what it does, all I know is
that if I don't have this line of code then the events for the scrollbar will
never be run. Anyone have any advice on what to do?
 
D

David M. Marcovitz

After you do anything that changes a slide, you can put the following
line of code:

ActivePresentation.Saved = True

This will make PowerPoint think it has already been saved.

If you use a button to navigate off the slide (probably your best
choice), you can put the code for resetting your scroll bar in there as
well as something like:

ActivePresentation.SlideShowWindow.View.Next

to go to the next slide.

I'm not sure if these things will solve your problems (I've never
programmed scroll bars in PowerPoint), but they should help.

--David

--
David M. Marcovitz
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 
B

Bill Dilworth

Hi Benjamin,

I would think that this would be easier/better to fake with hyperlinks, than
to really do in VBA. (Anyone that knows me knows this is different than my
normal stance on VBA)

You could make the 'Image' of a scroll bar (without the current location
block). Then insert 'hidden' hyperlinks to each of the presentation's
slides appropriately spaced along the scrollbar. Then just insert the
current slide location block over the link for the current slide.

Using this method, the scrollbar would always work - if macros are enabled
or not, if VBA support is enabled or not, or even in both of the viewer
programs.

Of course this is not a solution to your stated problem, I'll play with that
as time allows. It is just my initial impression.


--
Bill Dilworth
Microsoft PPT MVP Team
===============
Please spend a few minutes checking vestprog2@
out www.pptfaq.com This link will yahoo.
answer most of our questions, before com
you think to ask them.

Change org to com to defuse anti-spam,
ant-virus, anti-nuisance misdirection.
..
..
 

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