Consulting

Results 1 to 6 of 6

Thread: Code working when stepping through but not completely when assigned to rollover

  1. #1
    VBAX Newbie
    Joined
    Jan 2007
    Posts
    4
    Location

    Code working when stepping through but not completely when assigned to rollover

    Hi there,

    I am new to Powerpoint VBA and I've probably gone about the completely the wrong way.

    I've thrown together the code that should (in theory) hide named shapes, and I've assigned the various subs to run on mouse rollover of each image.

    When I step through the code it runs as expected, but for some reason when I am in slideshow view, and rollover the image, the code doesn't work as expected.

    Would someone mind having a look and telling me where I might be going wrong?

    I do have further work to do on this so I might be back for more questions!

    Thanks in advance,
    Averil

  2. #2
    VBAX Newbie
    Joined
    Jan 2007
    Posts
    4
    Location
    Hi all,

    Just waned to advise that I found out what the problem was...

    I should have been using:

    ActivePresentation.SlideShowWindow.View.Slide.Shapes("nameofshape").Visible = True
    Cheers,
    Averil

  3. #3
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    You should but here's a suggestion
    first select each of the shapes in turm and run this to add an ID tag
    Sub tagger()
    On Error GoTo err:
    ActiveWindow.Selection.ShapeRange.Tags.Add "include", "yesme"
    Exit Sub
    err:
    MsgBox "error"
    End Sub
    Then activate this on mouseover

    Sub mouseover(oshp As Shape)
    Dim i As Integer
    With ActivePresentation.SlideShowWindow.View.Slide
        For i = 1 To .Shapes.Count
            If .Shapes(i).Tags("include") = "yesme" Then .Shapes(i).Visible = True
            oshp.Visible = False
        Next i
    End With
    End Sub
    Last edited by Aussiebear; 04-28-2023 at 02:00 AM. Reason: Adjusted the code tags
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  4. #4
    VBAX Newbie
    Joined
    Jan 2007
    Posts
    4
    Location
    Thanks John, I will have a go at that

    One other quick question probably really simple answer but I mustn't be searching correctly... How do I go to a slide that I have named???

    While I am at it, I will ask for advise as to the next step...

    I have also created and named shapes which are half transparent rectangles that are aligned directly over each of the other images. The purpose for these is that my boss would like the images to appear "greyed out" if we've already been to the slides associated with it.

    e.g. If from the main slide, he decides to go into the option for "The future of Human Error", he'll go to the slides associated with that discussion; then ideally go back to this main screen where he would like that option to be greyed out (but still able to go back to just in case...).

    Regards,
    Averil

  5. #5
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    ActivePresentation.SlideShowWindow.View.GotoSlide (ActivePresentation.Slides("the name").SlideIndex)
    I would probably use the SlideID property instead of a name.

    ActivePresentation.SlideShowWindow.View.GotoSlide _
    (ActivePresentation.Slides.FindBySlideID(258).SlideIndex))
    would go to slideID = 258 eg

    slide ID is fixed and shouldnt change.
    Last edited by Aussiebear; 04-28-2023 at 02:01 AM. Reason: Adjusted the code tags
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  6. #6
    VBAX Newbie
    Joined
    Jan 2007
    Posts
    4
    Location
    Thank you very much!

    I've got it all working now

    For your information, to get the "greyed" out part working, I did the following:

     Option Explicit
    Dim intOptionSelected As Integer
    Dim Opt1Selected As Boolean
    Dim Opt2Selected As Boolean
    Dim Opt3Selected As Boolean
    Dim Opt4Selected As Boolean
    Dim Opt5Selected As Boolean
    Dim Opt6Selected As Boolean
    Dim Opt7Selected As Boolean
    Dim Opt8Selected As Boolean
     
    Sub BackToMain()
    'go to main dashboard
    ActivePresentation.SlideShowWindow.View.GoToSlide (ActivePresentation.Slides("Dashboard").SlideIndex)'work out which _
     images have already been clicked on and grey them out
    If Opt1Selected = True Then ActivePresentation.SlideShowWindow.View.Slide.Shapes("opt1grey").Visible = True
    If Opt2Selected = True Then ActivePresentation.SlideShowWindow.View.Slide.Shapes("opt2grey").Visible = True
    If Opt3Selected = True Then ActivePresentation.SlideShowWindow.View.Slide.Shapes("opt3grey").Visible = True
    If Opt4Selected = True Then ActivePresentation.SlideShowWindow.View.Slide.Shapes("opt4grey").Visible = True
    If Opt5Selected = True Then ActivePresentation.SlideShowWindow.View.Slide.Shapes("opt5grey").Visible = True
    If Opt6Selected = True Then ActivePresentation.SlideShowWindow.View.Slide.Shapes("opt6grey").Visible = True
    If Opt7Selected = True Then ActivePresentation.SlideShowWindow.View.Slide.Shapes("opt7grey").Visible = True
    If Opt8Selected = True Then ActivePresentation.SlideShowWindow.View.Slide.Shapes("opt8grey").Visible = True
    End Sub
     
    Sub OnClick1()
    'remember which image they clicked on
    Opt1Selected = True
    'go to the correct slide
    ActivePresentation.SlideShowWindow.View.GoToSlide (ActivePresentation.Slides("Pic1Slide").SlideIndex)
    End Sub
     
     'etc etc for each image
    At the end of the presentation, everything is set back to how it was

    Thanks for all your help.

    Cheers,
    AP
    Last edited by Aussiebear; 04-28-2023 at 02:03 AM. Reason: Adjusted the code tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •