ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Changing Text in PowerPoint (https://www.excelbanter.com/excel-programming/322476-changing-text-powerpoint.html)

KD[_4_]

Changing Text in PowerPoint
 
Hi,

I have written some Excel vba code that is supposed to
change the value of a text box in PowerPoint. I am using
Excel 2002 and PowerPoint 2002 and the problem is that
when I try and run the code it errors out and says :

Run-time error '-2147188160 (80048240)' :
TextFrame (unknown member ): Invalid request. This type of
shape cannot have a text range.

I am trying to update text within a rectangle - so could
this be the reason my code of :

oPPTApp.ActivePresentation.Slides(slide_no).Select
With oPPTApp.ActivePresentation.Slides(slide_no)
For Each oPPTShape In .Shapes
If oPPTShape.TextFrame.TextRange.Text = find_text Then
oPPTShape.TextFrame.TextRange.Text = replace_text

......


does not work? How else could I get around the problem of
trying to update a rectangle with text within it?

Many thanks
KD

Andy Pope

Changing Text in PowerPoint
 
Hi,

Is it possible you have objects on the slide that do not have a
textframe property, like a chart?

Maybe use some error handling or test the shape type before trying to
change the property.

Cheers
Andy

KD wrote:
Hi,

I have written some Excel vba code that is supposed to
change the value of a text box in PowerPoint. I am using
Excel 2002 and PowerPoint 2002 and the problem is that
when I try and run the code it errors out and says :

Run-time error '-2147188160 (80048240)' :
TextFrame (unknown member ): Invalid request. This type of
shape cannot have a text range.

I am trying to update text within a rectangle - so could
this be the reason my code of :

oPPTApp.ActivePresentation.Slides(slide_no).Select
With oPPTApp.ActivePresentation.Slides(slide_no)
For Each oPPTShape In .Shapes
If oPPTShape.TextFrame.TextRange.Text = find_text Then
oPPTShape.TextFrame.TextRange.Text = replace_text

.....


does not work? How else could I get around the problem of
trying to update a rectangle with text within it?

Many thanks
KD


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info

KD[_4_]

Changing Text in PowerPoint
 
Hi,

Thanks that seems to work now I've put a test in place -
also how do I change the color of my new text, I am
trying :

oPPTShape.TextFrame.TextRange.Font.Color=38

and it does not appear to be working.

Many thanks for your help

KD

-----Original Message-----
Hi,

Is it possible you have objects on the slide that do not

have a
textframe property, like a chart?

Maybe use some error handling or test the shape type

before trying to
change the property.

Cheers
Andy

KD wrote:
Hi,

I have written some Excel vba code that is supposed to
change the value of a text box in PowerPoint. I am

using
Excel 2002 and PowerPoint 2002 and the problem is that
when I try and run the code it errors out and says :

Run-time error '-2147188160 (80048240)' :
TextFrame (unknown member ): Invalid request. This type

of
shape cannot have a text range.

I am trying to update text within a rectangle - so

could
this be the reason my code of :

oPPTApp.ActivePresentation.Slides(slide_no).Select
With oPPTApp.ActivePresentation.Slides(slide_no)
For Each oPPTShape In .Shapes
If oPPTShape.TextFrame.TextRange.Text = find_text

Then
oPPTShape.TextFrame.TextRange.Text = replace_text

.....


does not work? How else could I get around the problem

of
trying to update a rectangle with text within it?

Many thanks
KD


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
.


Andy Pope

Changing Text in PowerPoint
 
Hi,

I assume the text appears black.
You need to specify the color either using RGB or SchemeColor.

oPPTShape.TextFrame.TextRange.Font.Color.RGB=RGB(2 55,0,0) ' Red

oPPTShape.TextFrame.TextRange.Font.Color.SchemeCol or = 4

Cheers
Andy

KD wrote:
Hi,

Thanks that seems to work now I've put a test in place -
also how do I change the color of my new text, I am
trying :

oPPTShape.TextFrame.TextRange.Font.Color=38

and it does not appear to be working.

Many thanks for your help

KD


-----Original Message-----
Hi,

Is it possible you have objects on the slide that do not


have a

textframe property, like a chart?

Maybe use some error handling or test the shape type


before trying to

change the property.

Cheers
Andy

KD wrote:

Hi,

I have written some Excel vba code that is supposed to
change the value of a text box in PowerPoint. I am


using

Excel 2002 and PowerPoint 2002 and the problem is that
when I try and run the code it errors out and says :

Run-time error '-2147188160 (80048240)' :
TextFrame (unknown member ): Invalid request. This type


of

shape cannot have a text range.

I am trying to update text within a rectangle - so


could

this be the reason my code of :

oPPTApp.ActivePresentation.Slides(slide_no).Sel ect
With oPPTApp.ActivePresentation.Slides(slide_no)
For Each oPPTShape In .Shapes
If oPPTShape.TextFrame.TextRange.Text = find_text


Then

oPPTShape.TextFrame.TextRange.Text = replace_text

.....


does not work? How else could I get around the problem


of

trying to update a rectangle with text within it?

Many thanks
KD


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
.


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info


All times are GMT +1. The time now is 01:56 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com