Works on a PC but does not work on a mac

L

Linda

The following code works on my PC but not the mac. Any suggestions
for
how it works on a mac would be greatly appreciated:


Function ApplyToAll()
Dim s
Dim max As Integer
Dim j As Integer
max = ActivePresentation.Slides.Coun t


For j = 1 To max
ActivePresentation.Slides(j).S elect - my error happens with this line
-
Run-time error '-247188160 (-7ffb7dc0) Slide (unknown member): Invalid
request. This view does not support Selection


ApplySavedValues
SaveDataFromForm
PutDataIntoNotesPage
Next j
End Function
 
S

Steve Rindsberg

Linda said:
The following code works on my PC but not the mac. Any suggestions
for
how it works on a mac would be greatly appreciated:

Function ApplyToAll()
Dim s
Dim max As Integer
Dim j As Integer
max = ActivePresentation.Slides.Coun t

For j = 1 To max
ActivePresentation.Slides(j).S elect - my error happens with this line
-
Run-time error '-247188160 (-7ffb7dc0) Slide (unknown member): Invalid
request. This view does not support Selection

ApplySavedValues
SaveDataFromForm
PutDataIntoNotesPage
Next j
End Function

It's probably more a case of what view you're currently in than a PC vs Mac
thing, though it's possible that the Mac version is stricter about data types;
strictly speaking, j should be a Long, not an Integer.

You might consider rewriting the code so as not to use a selection. It'll run
faster and more reliably.

Dim oSl as Slide
Set oSl = ActivePresentation.Slides(j)


================================================
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
 
D

David M. Marcovitz

If you are copying and pasting code, then you might want to check out the
space between S and elect in Select. As Steve said, Select does not work
in Slide Show view, so that could be a problem if you are running it in
Slide Show view.
--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 
L

Linda

Thanks Steve, but what do I use if I can't select a slide. What I want
to do is gather data from a custom dialog box and have it applied to
all slides in the speaker notes area. The code must have the ability
to populate the speaker notes, go to the next slide, populate the same
information on that slide, until all slides are populated with specific
data.


 
S

Steve Rindsberg

Linda said:
Thanks Steve, but what do I use if I can't select a slide. What I want
to do is gather data from a custom dialog box and have it applied to
all slides in the speaker notes area. The code must have the ability
to populate the speaker notes, go to the next slide, populate the same
information on that slide, until all slides are populated with specific
data.

There's no need to select a slide to work with it or the shapes on it.
Yeah, I know it FEELs crazy but it works.

Sub Example()

Dim oSl as Slide
Dim oSh as Shape

For Each oSl in ActivePresentation.Slides

' Do something with it ... notice that nothing's selected:
MsgBox oSl.Name

' Now let's mess with the text on the notes pages
For Each oSh in oSl.NotesPage.Shapes
If oSh.HasTextFrame then
if osh.textframe.hastext then
msgbox osh.textframe.textrange.text
End if
End if
Next oSh

Next oSl

End Sub
================================================
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
 
L

Linda

Steve,
When I cut and paste your code in to test it, your if statements fail.

If oSh.HasTextFrame then
if osh.textframe.hastext then
msgbox osh.textframe.textrange.text
End if
End if
 
S

Steve Rindsberg

Steve,
When I cut and paste your code in to test it, your if statements fail.

If oSh.HasTextFrame then
if osh.textframe.hastext then
msgbox osh.textframe.textrange.text
End if
End if

Fail in what way?

If you mean that the shape doesn't pass the test and get past the IF statement,
it may be because the IF tests are doing exactly what they're intended to do:
filter out shapes that don't have text frames (lines, for example, cannot
contain text) or shapes w/o text.

================================================
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
 

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