Select whole presentation in PowerPoint 2007

G

gfox

Hi There,

The following macro does not seem to work in PowerPoint 2007:

Private Sub SelectAll()

'Open any ppt documen
Presentations.Open "C:\test.ppt"

'Select the whole presentation
ActivePresentation.Slides.Range.Select

End Sub

Its purpose is to select the all the slides in the presentation (i'll need
to get its whole TextRange later on).

When you run it, only the last slide get selected... Note that the macro is
working on PowerPoint 2003.

Any idea why? Any workaround?
 
G

gfox

Okie.

I will try to explain what I am trying to achieve.
Basically, I'm working on a parser that is implemented using a PowerPoint
macro.

I've got a PowerPoint document template that contains some syntax elements,
which are parsed by the macro. For instance, you can define tags like
"<mytagname>" which get replaced by the macro with the right text.

So far, I've been using a macro that is based on text selection in the whole
slide range to parse and replace those tags, which works fine with 2003.

I've checked the code samples from the site you gave me and I understand
that the best way to replace all my tags is to loop on each slipe and each
shape that contains text.
I think that would be ok for me as long as I had only simple tags like to
replace (the one I quoted).

Unfortunately things are not that easy. The syntax elements I am parsing are
far more complex. Example: the user can define loops in his PowerPoint
template:

<ForEach:User>
<Name>
<Profile>
</ForEach>

and those loops can spread on several slides:

--------Slide 1-------
<ForEach:User>
--------Slide 2-------
<FirstName>
--------Slide 3-------
<LastName>
--------Slide 4-------
</ForEach>

With my current parser (which is based on text selection), i would select
the content of my loop and copy paste it as many times as i have elements in
the loop. Which would produce the following result:

--------Slide 1-------
John
--------Slide 2-------
Doe

--------Slide 3-------
Paul
--------Slide 4-------
Smith

I'm not sure how to achieve this if i have to rewrite the parser to process
the text of each shape one after the other. As you can see, selecting text on
multiple slides allows me to copy/paste large block that can spread on
several shapes and slides.

Any suggestion to avoid using selection and still be able to achieve what i
want?
 
G

gfox

Hi Steve,

Great! Setting the ViewType of the ActiveWindow to ppViewOutline do exactly
what i want (I actually did not know that you can set it to this value)!

Now I've got one more problem (hopefuly the last one!): I'm having issues
when using the ActiveWindow.Selection.TextRange. Whenever I've got text
selected in the Outline View and try to use the methods cut, paste, delete or
set the Text i've got a "Permission Denied" error.

The TextRange object is valid, but seems to be "read-only". How can I do if
i want to delete the current selection (or the content of a TextRange more
generally)?

Thanks
 

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