Searching Powerpoint from excel

J

jimr

I am attempting to search the hyperlink address of various slides on a
powerpoint master slide based on the addresses contained in Excel collumn. I
have set up the necessary resources in Excel and made a start at my
definitions in VB

Dim PPApp As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Hyperlink.Address

Now, I know how, on the Powerpoint, thanks to some excellent help on the
Powrpoint forum, to search and change the hyperlink.address object in
Powerpoint:

For Each s In ActivePresentation.Slides
For Each h In s.Hyperlinks
tip = h.ScreenTip
h.Address = Replace(h.Address, OldUrl, NewUrl)
h.ScreenTip = tip
h.ScreenTip = Replace(h.ScreenTip, OldUrl, NewUrl)
Next
Next

What I need is how to open the relevant powerpoint file, search on a value
from a collumn and return some sort of message saying that it was or was not
found. Not much to ask for :(

If anyone can give me a clue, I would greatly appreciate it.
 
Z

zackb

Hello there,

I am going to go with the assumption that you have referenced the
appropriate version of PowerPoint in the VBE (Alt + F11) | Tools |
References section.

You may be able to use something like this ...



Option Explicit

Sub PowerPointTesting()
'assumes a reference has been set to:
'Microsoft PowerPoint xx.0 Object Library
'where xx is your version number
Dim PPApp As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide '.Hyperlink.Address
Dim h As PowerPoint.Hyperlink, s As PowerPoint.Slide
Dim fName As String, OldUrl As String, NewUrl As String
Dim tip
'** ---------------------------------------------------- **
fName = "C:\Documents and Settings\Rob\Desktop\test.ppt"
'** ---------------------------------------------------- **
Set PPApp = CreateObject("PowerPoint.Application")
PPApp.Visible = True
Set PPPres = PPApp.Presentations.Open(fName)
For Each s In PPPres.Slides 'ActivePresentation.Slides
For Each h In s.Hyperlinks
tip = h.ScreenTip
h.Address = Replace(h.Address, OldUrl, NewUrl)
h.ScreenTip = tip
h.ScreenTip = Replace(h.ScreenTip, OldUrl, NewUrl)
Next
Next
'optional---
PPPres.Close
PPApp.Quit
'-----------
Set PPApp = Nothing
Set PPPres = Nothing
Set PPSlide = Nothing
Set s = Nothing
Set h = Nothing
End Sub



Still not sure what your OldUrl and NewUrl are, or how they are defined. I
dimensioned them as Strings, only because I was unsure of their nature, it
wasn't specified.

This could be a starter for you. It works for me.


HTH, and regards,
Zack Barresse
 

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

Top