Title of PowerPoint linked to a 'name' in an Excel file

T

Tony Bender

I have an Excel application ("Shop.xls") which allows users to copy
Excel charts directly to a PowerPoint deck ("Shop.ppt").

At the start of the application the user selects a geography from a
drop-down and the result appears in a specific cell which is 'named'
TARGET.

I would like to program the application to automatically insert the
TARGET into the title of the corresponding PowerPoint deck. The
current title reads "An overview of shopper trends at XXX",
and I would like to set the title to read "An overview of shopper
trends at TARGET" based on whatever selection the user made up front.

Can this be done, and if so how do I write the code? Is the code
written in an Excel macro, or in a PowerPoint macro?

Many thanks..
 
B

Barb Reinhardt

Here are some ideas.

You'll have to select PowerPOint within your References to get this to work.
You can also use late binding, but it's easier to understand at first this
way.

Dim PPTApp as PowerPoint.application
Dim myPPT as PowerPoint.Presentation.

'Need to define PPTApp with GetObject or CreateObject. That exercise is
left to the user :)

Need to open myPPT. Do something like you would for Excel, but do

Set myPPT = PPTApp.Presentations.Open ...

When you get the presentation open, you can do something like this

Dim mySlide as PowerPoint.Slide

for each mySlide in myPPT.Slides
.blay blah blah to go through the slides
next mySlide

if you know the slide number, you can do

Set mySlide = pptapp.slides(8) 'or whatever the number

To get to the Title do this
dim myTitle as PowerPoint.shape

Set myTitle = Nothing
on Error resume next
Set myTitle = myslide.shapes.title

if not mytitle is nothing then
mytitle.textframe.textrange.text = "Enter your title here"
end if

I know this is kind of skeletal, but you should be able to get there knowing
what you know about Excel. I found the object models to be fairly similar
(OK, I know there's a lot that's not in PowerPoint).

If you have other questions, come back. I'll check again in the AM.

HTH,
Barb Reinhardt
 

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