View Full Version : [SLEEPER:] Application.Caller for PPT
mr.bjerre
07-10-2012, 05:47 AM
Hi,
In excel there is an Application.Caller to determine which button or whatever that called the Sub. Is there anything similar in Powerpoint?
John Wilson
07-10-2012, 06:13 AM
There's no Application.caller in PPT
Probably best if you explain what you need to do in PowerPoint.
mr.bjerre
07-10-2012, 06:46 AM
I'm calling a Sub from different shapes and I need to determine from which shape the Sub is being called
John Wilson
07-10-2012, 07:20 AM
Maybe pass an object variable when it is clicked
Sub yoursub(oshp As Shape)
MsgBox oshp.Name
'rest of code
End Sub
If this isn't it you should post some sample code
mr.bjerre
07-17-2012, 01:50 AM
Exactly! Thank you
mr.bjerre
07-17-2012, 02:57 AM
But now I have another problem. I need to replace 7 with a dynamic slidenumber
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
The problem is that
ActiveWindow.View.Slide.SlideNumber
doesn't work within my sub.
Cosmo
07-17-2012, 08:15 AM
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.
John Wilson
07-18-2012, 10:26 AM
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
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.