Object does not have expected properties - code used to work

  • Thread starter Colleyville Alan
  • Start date
C

Colleyville Alan

I have an application that was working fine a couple of months ago. Now I
want to adapt some of the code for a different project but suddenly, the
code does not work. Even more strange, properties that should be associated
with the object are no longer present.

Specifically, I am looking to pull the text out of textboxes on a slide. My
code checks each shape on the slide and if the type = 17 (textbox) then it
pulls out the text. It does check first to see if there is text in the box
as sometimes I get a slide with an empty text box that is invisible and it
crashes the program if the program tries to get text from an empty box, so
this is the line of code that I placed in there that was working just fine a
little while ago, but not now:

If oShape.TextFrame.TextRange.Text <> "" Then

I get an error message of "Method or data member not found" and the
TextRange portion of that line is highlighted. I have checked the object
model, and it *is* a part of TextFrame. But when I try to type using the
VBA autocompletion feature, it lists as options only "Application, Creator,
MarginBottom, MarginLeft, MarginRight, MarginTop, Orientation, and Parent.
That's 8 properties when the object explorer shows that there are 45
properties. The TextFrame property is not showing and a slew of other Shape
properties are not there either, what's gong on!?!?!

I am running this using Automation from Excel and I have the references
checked. Still, it looks as though PPT is thinking of something else other
than a shape.

Any insights would be appreciated.
Thanks
 
C

Colleyville Alan

I am running this using Automation from Excel and I have the references
checked. Still, it looks as though PPT is thinking of something else other
than a shape.

I meant to write that I was running this using Automation from Access, not
from Excel (though it probably does not matter)
 
C

Colleyville Alan

Shyam Pillai said:
What are the object declarations in the code?

The object declarations do not seem to be the problem. I found an old
database and checked the code, it is *identical* to the code that is
failing. But when I look at the references, some things are in a different
order now than in the older version. I suspect the MS Office 9.0 library
since I have it just ahead of PPT in this database and just behind in the
one that works.
 
C

Colleyville Alan

Colleyville Alan said:
The object declarations do not seem to be the problem. I found an old
database and checked the code, it is *identical* to the code that is
failing. But when I look at the references, some things are in a different
order now than in the older version. I suspect the MS Office 9.0 library
since I have it just ahead of PPT in this database and just behind in the
one that works.

Sure enough, the MS Office Library was the problem. I moved it down in the
heirarchy and now the code works. I probably should remove it altogether.
Is there an easy way to check to see if there are functions/properties that
are unique to a library so that you do not uncheck one by mistake?
Thanks
 
B

Brian Reilly, MS MVP

You should always Compile your code before assuming everything works.
I don't always and usually it's when I run into trouble (g). That
should have isolated the problem but maybe not. Also watch out for
moving back and forth between versions of Office since the higher
version will reset the references when run (compiled) on a higher
version.

Brian Reilly, PowerPoint MVP
 
C

Colleyville Alan

Brian Reilly said:
You should always Compile your code before assuming everything works.
I don't always and usually it's when I run into trouble (g). That
should have isolated the problem but maybe not. Also watch out for
moving back and forth between versions of Office since the higher
version will reset the references when run (compiled) on a higher
version.

It's been real fun working with this on two different computers, I have to
change paths every time and have a different Active X registered on each.
Now I get the references blues on top of it!
Thanks for the advice.
 

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