Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A Quick introduction to Slides Tags

Powerpoint

A Quick introduction to Slides Tags

by  Chance1234  Posted    (Edited  )

One of the most useful things i find when programming in powerpoint is Slide Tags.

Tags allow the developer to assign extra information to a slide in a presentation and retrieve it via code

In the following example which is cut down from a routine which creates a new presenation and adds various slides

I am adding one tag to my new slides, which i have simply titled "Orient" being short for orientation. My presenation

contains a mix of horizontal and vertical slides, so i can print them properly (see other faq) I assign and read this tag

heres the code for adding a tag to a slide

Code:
Global pp_Final As New Presentation ' No need for new word  in XP
Global pp_Tools As Presentation ' This Presentation

Sub example
Dim sld_Temp As Slide 'tempoary slide

'create a new presentation
Set pp_Final = Application.Presentations.Add

'My actual code this is coming from contains a loop here which 
'calls different elements and copies slides from another presentation inserting them 
'into the new presentation, you will need to change the below to suit your needs

pp_Vert.Slides("sldifa").Copy 'this is the line that needs changing
pp_Final.Slides.Paste 'this is the paste

Set sld_Temp = pp_Final.Slides(2) ' number being the new slide i have bought in ' again change for needs 

'Now we come to the tag! 

 sld_Temp.Tags.Add "Orient", "V" ' the V is the value im assigning to this tag 

end sub

Now to retrieve the tag value from all slides in a presenation the code looks like this

Code:
For Each var In pp_Final.Slides
    debug.print  var.Tags("Orient")
next

Please see my FAQ on working with Horizontal and Vertical slides for a practical example
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top