Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PowerPoint Run-Time error '438': Object Doesn't support this property 2

Status
Not open for further replies.

PWD

Technical User
Jul 12, 2002
823
GB
Code:
    Set PPSlide = ActivePresentation.Slides(Application.ActiveWindow.Selection.SlideRange.SlideIndex)
    
    Set MyText = PPSlide.Shapes("TextBox TV")
    MyText.TextRange = XLApp.Range("TVAd")

Gives this error code - which I assume is because of the ".TextRange". Whereas this works just fine:-
Code:
    Set PPSlide = ActivePresentation.Slides(Application.ActiveWindow.Selection.SlideRange.SlideIndex)

    PPSlide.Shapes("TextBox TV").Select
    ActiveWindow.Selection.TextRange = XLApp.Range("TVAd")

And so does this (for testing purposes!!):-

Code:
    Set PPSlide = ActivePresentation.Slides(Application.ActiveWindow.Selection.SlideRange.SlideIndex)
    
    Set myitem = PPSlide.Shapes("TVAdVisibility Amber")

    With myitem
        With .Fill
        .ForeColor.RGB = RGB(255, 0, 0)
        .ForeColor.RGB = RGB(255, 192, 0)
        .Visible = msoFalse
        .Visible = msoTrue
        End With
    End With

(I know I'm trying to do this for a TextBox & the other example is a Shape.)

Obviously I'd like to eliminate "Selects" &, perhaps, simplify my code writing by using "MyText" over & over. Perhaps, if I can get it working, I could use an array of names (I'll amend so they're the same in Excel as in PowerPoint) with a loop?

Any ideas?

Many thanks,
D€$
 
You could try:
MyText.TextFrame.TextRange=...

combo
 


This is been an invaluable tool in my toolbox. Using it, I have discovered many things about some specific object/state that I might otherwise have overlooked.

faq707-4594

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Thanks combo. Thanks, too, Skip.

I've now graduated to:-
Code:
    ONames = Array("TVAd", "CompetitorTVAd", "Retail" ......)
        For Each OName In ONames
            Set MyText = PPSlide.Shapes("TextBox " & OName)
            MyText.TextFrame.TextRange = XLApp.Range(OName)
        Next OName

So I used the Immediate Window to find out that Slide 5 is called "Slide349" & that Slide 7 is called "Slide354" !

Again, I can select the slide with:-

Code:
ActivePresentation.Slides.Range("Slide349").Select

But I'd really like to be able rename the slides to match how they appear to be, i.e. "Slide5". Oh, like this, you mean?

Code:
ActivePresentation.Slides.Range("Slide349").Name = "Slide5"

And now I can find out what they're all called:-

Code:
    For Each Slide In ActivePresentation.Slides
        Debug.Print Slide.Name
    Next Slide

So far, so good!! :)

Many thanks,
D€$
 
I've just renamed them all:-

Code:
    n = 1
    
    For Each Slide In ActivePresentation.Slides
        Debug.Print Slide.Name
        SlideName = Slide.Name
        
        ActivePresentation.Slides.Range(SlideName).Name = "Slide" & n
        
          Debug.Print Slide.Name
        n = n + 1
    Next Slide

Many thanks,
D€$
 
You can use SlideIndex too:

For Each S In ActivePresentation.Slides
S.Name = "Slide" & S.SlideIndex
Next S

combo
 
Skip - Question on the watch window (by the way, great FAQ) - let me know if I should start a new thread...so, I haven't used the watch window,but I have been following this thread and saw the FAW and got it open the object model, but I use the locals window all the time...I can see variables change, reset them during execution/debug...but I can also dig down through the object model...so, is the watch window better than the locals windows, if it is, then why...thanks in advance

Ernest

Be Alert, America needs more lerts
 


Ernest,

Start your own thread on that topic.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top