VBA in Powerpoint

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello All!
I am trying to work with the "Tags Object" in powerpoint so that I can
manipilate
a presentation based on a tags namew and or value. What I wast to do is ...

1. Loop through all of the Shapes in a presentation so that I can add Tags
based on a value in the Slide Title.

2. Loop through each "msoEmbeddedOLEObject" in a presentation and Tag them
with a Tag name based on the Presentation's name.

3. Open the msoEmbeddedOLEObject with excel and manipulate the data by
adding formulas to a column in the spreadsheet.

I have been getting better with my codeing in Excel but this powerpoint
thing has got my in a brain-freeze. I have searched the web but there does
not seem to be much out there to help me (or I do not know enough to put the
right search arguments in.)
Any help would be greatly appreciated! Thanks
 
I am trying to work with the "Tags Object" in powerpoint so that I can
manipilate
a presentation based on a tags namew and or value. What I wast to do is ...

1. Loop through all of the Shapes in a presentation so that I can add Tags
based on a value in the Slide Title.

2. Loop through each "msoEmbeddedOLEObject" in a presentation and Tag them
with a Tag name based on the Presentation's name.

All do-able. What code have you got so far and what's not working?

3. Open the msoEmbeddedOLEObject with excel and manipulate the data by
adding formulas to a column in the spreadsheet.

This gives a link to Jon Peltier's article on automating Excel from other apps:

Automate Excel from PowerPoint. Automate PowerPoint from Excel. And so on.
http://www.rdpslides.com/pptfaq/FAQ00368.htm
 
Hi steve,

Thanks for the fast response. Here is one of the code samples I pulled
from the net. I cannot even get it to count all shapes in a presentation let
alone ditinctly the msoEmbeddedOLEObjects in the presentation. As far as
basing the Tag Name/values on shape or objectcontent or file names, I frankly
do not know where to begin.

Code Follows:

Sub TagShapes()

Dim oSl As Slide
Dim oSlObject As Object
Dim oSlides As Slides
Dim oCom As Object
Dim i As Long

Set oSlides = ActivePresentation.Slides

' Test message to see if my syntax is working
MsgBox "There are " & Shapes.Count & " In this Presentation"

For Each oSl In oSlides
Set oSlObject = oSl
For i = 1 To .Shape.Count
With oSl.Shapes.Item(i).Tags
.Add "TEST_TAG_NAME", "YadaYadaYada"
End With
Next
Next oSl

End Sub

Thanks again for the response.

Regards,
Patrick
 
On Mon, 11 Apr 2005 08:34:01 -0700, "PSKelligan"

Hi,
8<-----------

Code Follows: Syntax Errors removed...

Sub TagShapes()

Dim oSl As Slide
Dim oSlObject As Object
Dim oSlides As Slides Dim osh As Shape
Dim oCom As Object
Dim i As Long
Set oSlides = ActivePresentation.Slides
For Each oSl In oSlides
For each osh In oSl.shapes
If osh.Type = msoEmbeddedOLEObject Then
...
endif
Next
Next oSl

End Sub

Hope, that helps


Gruß HW


WebSite Excelenzen & Powerpoint interaktiv: www.lemitec.de/public
Events zu PowerPoint:VBA Workshop: http://www.ppt-user.de
 
Hi Hans,
That helps some, however I need to enumerate the all of the shapse in the
presentation as well as enumerate just the msoEmbeddedOLEObjects. What would
the syntax be to count all of the shapes and then just all of the
msoEmbeddedOLEObjects in a presentation?

thank you,
Patrick
 
PSKelligan said:
Hi steve,

Thanks for the fast response. Here is one of the code samples I pulled
from the net. I cannot even get it to count all shapes in a presentation let
alone ditinctly the msoEmbeddedOLEObjects in the presentation. As far as
basing the Tag Name/values on shape or objectcontent or file names, I frankly
do not know where to begin.

Code Follows:

Sub TagShapes()

Dim oSl As Slide
Dim oSlObject As Object
Dim oSlides As Slides
Dim oCom As Object
Dim i As Long

Set oSlides = ActivePresentation.Slides

' Test message to see if my syntax is working
MsgBox "There are " & Shapes.Count & " In this Presentation"

For Each oSl In oSlides
Set oSlObject = oSl
For i = 1 To .Shape.Count
With oSl.Shapes.Item(i).Tags
.Add "TEST_TAG_NAME", "YadaYadaYada"
End With
Next
Next oSl

End Sub


Let's try that again with a few changes:

Sub TagShapes()

Dim oSl As Slide
Dim oSh as Shape
Dim i As Long

For Each oSl In ActivePresentation.Slides
For Each oSh in oSl.Shapes
oSh.Tags.Add "TEST_TAG_NAME", "YadaYadaYada"
' You wanted a count of the shapes so:
i = i + 1
' Is it an OLEembedded thingie?
If oSh.Type = msoEmbeddedOLEObject Then
' Plug in Jon P's code here
End If
Next oSh
Next oSl

End Sub

Let me know how that works out.
 
Hi Steve,
That seems to be what I am looking for Steve. It will take a little
Digestion though. Could you tell me what the syntax would be to just count
the msoEmbeddedOLEObjects?

Thanks for all your help,
Patrick
 
If you need to count the embedded objects, it's just a matter of adding another
counter:

Sub TagShapes()

Dim oSl As Slide
Dim oSh as Shape
Dim i As Long
' New counter:
Dim lOleShapes as long

For Each oSl In ActivePresentation.Slides
For Each oSh in oSl.Shapes
oSh.Tags.Add "TEST_TAG_NAME", "YadaYadaYada"
' You wanted a count of the shapes so:
i = i + 1
' Is it an OLEembedded thingie?
If oSh.Type = msoEmbeddedOLEObject Then
' Plug in Jon P's code here
' Increment the counter
lOleShapes = lOleShapes + 1
End If
Next oSh
Next oSl

' and show the results:
MsgBox "There were " & cstr(i) & " shapes of which " _
& cstr(lOleShapes) & " were OLE embedded objects."
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top