Consulting

Results 1 to 8 of 8

Thread: Application.Caller for PPT

  1. #1

    Application.Caller for PPT

    Hi,

    In excel there is an Application.Caller to determine which button or whatever that called the Sub. Is there anything similar in Powerpoint?

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    There's no Application.caller in PPT

    Probably best if you explain what you need to do in PowerPoint.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  3. #3
    I'm calling a Sub from different shapes and I need to determine from which shape the Sub is being called

  4. #4
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    Maybe pass an object variable when it is clicked

    [vba]Sub yoursub(oshp As Shape)
    MsgBox oshp.Name
    'rest of code
    End Sub[/vba]

    If this isn't it you shoulod post some sample code
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  5. #5
    Exactly! Thank you

  6. #6
    But now I have another problem. I need to replace 7 with a dynamic slidenumber

    [VBA]Sub ViewHide(shpCall As shape)

    '------------
    Dim strName As String, blVisible As Boolean

    '------------
    strName = Right(shpCall.Name, Len(shpCall.Name) - 3)
    blVisible = ActivePresentation.Slides(7).Shapes("rctBack").Visible

    If Not blVisible Then
    ActivePresentation.Slides(7).Shapes("rctBack").Visible = msoTrue
    ActivePresentation.Slides(7).Shapes("grp" & strName).Visible = msoTrue
    Else
    ActivePresentation.Slides(7).Shapes("rctBack").Visible = msoFalse
    For Each shp In ActivePresentation.Slides(7).Shapes
    If Left(shp.Name, 3) = "grp" Then shp.Visible = msoFalse
    Next
    End If

    End Sub[/VBA]

    The problem is that

    [VBA]ActiveWindow.View.Slide.SlideNumber[/VBA]

    doesn't work within my sub.

  7. #7
    VBAX Contributor
    Joined
    May 2008
    Posts
    198
    Location
    I'm assuming you want the slide that shpCall is on?

    If so, try

    shpCall.parent.slidenumber

    You may want to verify that 'shpCall.parent' is actually a slide first. If it's on a master or template page, that won't work.

  8. #8
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    Mark's code should work.

    Re your code:

    You are, I guess, in show view so you would have to use
    SlideShowWindows(1).View.Slide.SlideNumber
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

Posting Permissions

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