i have a problem with powerpoint macro...

  • Thread starter Thread starter nushi
  • Start date Start date
N

nushi

Does any one know how i can get the shape name or text inside the
shape when the user click on it and i active a macro?
i need to know that on the macro itself...
i have few shapes with the same macro on them
thenks :)
 
Try this

Sub nameofsub(oshp As Shape)
Dim oshp As Shape
Dim strName As String
Dim strText As TextColumn2
strName = oshp.Name
If oshp.HasTextFrame Then
If oshp.TextFrame.HasText Then
strText = oshp.TextFrame.TextRange
End If
End If
End Sub
 
Nushi said:
Does any one know how i can get the shape name or text inside the
shape when the user click on it and i active a macro?
i need to know that on the macro itself...
i have few shapes with the same macro on them
thenks :)

Give the shape an action setting of Run Macro and assign it to run this macro:

Sub AboutThisShape(oShp As Shape)

MsgBox oShp.Name

If oShp.HasTextFrame Then
If oShp.TextFrame.HasText Then
MsgBox oShp.TextFrame.TextRange.Text
End If
End If

End Sub
 
it does'nt work...
i have this code :
Sub AddGroup(oshp As Shape)
Dim x As Integer
Dim y As Integer
x = 130
y = 170
Dim mySlide As Slide
Dim oshp As Shape
Dim strName As String
Dim strText as TaxtColumn2
If oshp.HasTextFrame Then
If oshp.TextFrame.HasText Then
strText = oshp.TextFrame.TextRange
End If
End If
Set mySlide = ActivePresentation.Slides.Item(13)
Dim NumberOfElements As Integer
NumberOfElements = mySlide.Shapes.Count
x = x + ((NumberOfElements - 2) * 30)
y = y + ((NumberOfElements - 2) * 30)
If (x > 250) Then
x = x - (x - 120)
End If
If (y > 250) Then
y = y - (y - 120)
End If
mySlide.Shapes.Title.TextFrame.TextRange.text = strText.text
Dim myShape As Shape
Set myShape = mySlide.Shapes.AddShape(msoShapeOval, x, y, 272.12,
272.12)

End Sub
the problem is that my PowerPoint Macro Editor does'nt know what is
TextColumn and it looks like i can't go into the macro from my
powerpoint if i use Sub AddGroup(oshp As Shape)
thenks for all your help...
 
Give the shape an action setting of Run Macro and assign it to run this macro:

Sub AboutThisShape(oShp As Shape)

MsgBox oShp.Name

If oShp.HasTextFrame Then
If oShp.TextFrame.HasText Then
MsgBox oShp.TextFrame.TextRange.Text
End If
End If

End Sub

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================

thenks that helped
:):):)
 
Back
Top