PDA

View Full Version : Solved: Selection produces "Variable Not Defined"



Paul_Hossler
11-02-2010, 06:32 PM
Still working on a way to update slide elements based on document properties (see other post)

I thought that I'd try to add a tag to shapes, place holders, etc. and then have the SlideShow begin event update the shapes, etc. if they had a tag

So if a shape had the 'Subject' tag, it's text woudl be updated with the 'Subject' document property

First step was a way to 'tag' the selected shape, etc.

However, I keep getting a "Variable Not Defined" and Selection is high lighted. I cannot figure out why.



Sub AddTag()
Dim sTagName As String, sTagValue As String

If Selection.Type = ppSelectionNone Then Exit Sub

sTagName = InputBox("Enter Tag Name for the selected " & Selection.Type, "Tags", vbNullString)
If Len(sTagName) = 0 Then Exit Sub

sTagValue = InputBox("Enter Tag Value for the Tag " & sTagName, "Tags", vbNullString)
If Len(sTagValue) = 0 Then Exit Sub

Selection.Tags.Add sTagName, sTagValue

End Sub



Paul

Cosmo
11-03-2010, 05:28 AM
Still working on a way to update slide elements based on document properties (see other post)

I thought that I'd try to add a tag to shapes, place holders, etc. and then have the SlideShow begin event update the shapes, etc. if they had a tag

So if a shape had the 'Subject' tag, it's text woudl be updated with the 'Subject' document property

First step was a way to 'tag' the selected shape, etc.

However, I keep getting a "Variable Not Defined" and Selection is high lighted. I cannot figure out why.



Sub AddTag()
Dim sTagName As String, sTagValue As String

If Selection.Type = ppSelectionNone Then Exit Sub

sTagName = InputBox("Enter Tag Name for the selected " & Selection.Type, "Tags", vbNullString)
If Len(sTagName) = 0 Then Exit Sub

sTagValue = InputBox("Enter Tag Value for the Tag " & sTagName, "Tags", vbNullString)
If Len(sTagValue) = 0 Then Exit Sub

Selection.Tags.Add sTagName, sTagValue

End Sub



Paul
I believe you need to useApplication.ActiveWindow.Selection.Type

Paul_Hossler
11-03-2010, 01:23 PM
That works. Thanks

Paul