(Solved) – Delete/Remove tag of Powerpoint slide in VBA

  • by
(solved)-–-delete/remove-tag-of-powerpoint-slide-in-vba

I have created a code in order to allow me to tag slides which I use to manipulate a master Powerpoint file by code. I for example create smaller Powerpoint presentations based on tags of the master file (I can share the code if someone is interested). The reason for deleting the tags is that I have loops which go through all tags and I am afraid that the loop will take very long time to execute in the future because of all the tags if tags are never removed.

Sub Newtag()

Dim slidename As String
slidename = Application.ActiveWindow.View.Slide.Name

Dim Newname As String

Newname = InputBox("Give new name")
If Trim(Newname) = "" Then Exit Sub
ActivePresentation.slides(slidename).Tags.Add "Tag", Newname

End Sub

I’d like to be able to remove tags which I have added but I have not figured out how. I have tried with the following:

Let’s say that I want to remove the tag “Test tag” och slideindex 5 then my first guesses have been:

ActivePresentation.slides(5).Tags.Delete ("Test tag")

ActivePresentation.slides(5).Tags.Value(1).Delete

ActivePresentation.slides(5).Tags.Value("Test tag").Delete

But with no success. Any suggestions on how to solve this? Thx

Leave a Reply

Your email address will not be published. Required fields are marked *