Hi,
In excel there is an Application.Caller to determine which button or whatever that called the Sub. Is there anything similar in Powerpoint?
Hi,
In excel there is an Application.Caller to determine which button or whatever that called the Sub. Is there anything similar in Powerpoint?
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
I'm calling a Sub from different shapes and I need to determine from which shape the Sub is being called
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
Exactly! Thank you
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.
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.
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