Problem with Excel 2002

  • Thread starter Thread starter Doc
  • Start date Start date
D

Doc

I created an Excel file with Excel 2000. The file
contains Textboxes and CommandButtons. The VB code
associated code with the controls ran fine.

I brought the file home to modify on a computer that is
running Excel 2002 and the following error arises.

It appears VB is not recognizing the Activate method for
the textboxes or commandbuttons. When it encounter the
code, ActiveSheet.TextBoxName.Activate or
ActiveSheet.CommandButtonName.Activate
I receive the error: Runtime error 1004
Activate method of OLEObject Class failed

Any suggestions?

Thanks.
 
Doc,

Open up the VBA editor and check Tools/References.
Do any show up as "Missing"??

John
 
John,

I appreciate the prompt reply.

I opened Tools/References. A window opens with a list of
at least several hundred references. The only checked
ones are the first five and they are (in order):
Visual Basic for Applications
Microsoft Excel 10.0 Object Library
OLE Automation
Microsoft Office 10.0 Object Library
Microsoft Forms 2.0 Object Library

Without knowing what is supposed to be available, I don't
know if any are missing? Are they ALL supposed to be
checked???

Thanks again.

Doc
 
Doc,

Check for the word "Missing" in front of any of the checked references.
If it is missing uncheck the "Missing" reference. You might have a
problem with Late vise Early binding.
 
Doc,

Okay, I could have explained that better.
If one were "missing" it would have denoted it as such.
If Excel is "looking" for a particular Reference library
and it doesn't find it, it'll show up on that Library list
as missing.
What sometimes happens between versions is that
the library referenced by the older version is not
compatible with the library in the newer version.
Anyway, since none came up as missing, I don't think
that's your problem.
Are they ALL supposed to be checked???
Heavens NO!!!

Okay, back to square one.....
Post the code that's crashing and indicate which line it crashes on.

John
 
The word "Missing" is NOT present in front of any checked
reference.

This is exactly what happens. The Excel file is open. I
click on a Command Button and when it runs the VBA code
an error window pops-up with the following:

Runtime error 1004
Activate method of OLEObject Class failed

I choose Debug and the VBA editor opens with
ActiveSheet.DateOfSurgery.Activate highlighted in the
following line of code.

If Not DateFlag Then ActiveSheet.DateOfSurgery.Activate

DateOfSurgery is a textbox on the ActiveSheet.

The same thing happens when the following code is
executed:

ActiveSheet.SaveData.Activate

SaveData is a CommandButton on the ActiveSheet.

Doc
 
Doc,

It still could be a library reference compatibility issue.
Try fully qualifying the textbox/commmandbutton references.

e.g.
If Not DateFlag Then ActiveSheet.OLEObjects("DateOfSurgery").Activate
ActiveSheet.OLEObjects("SaveData").Activate

John
 
John,

I made both changes and there were no changes.

Why the Activate method? The Select method works fine.
Are there any libraries I could be missing? Why I would
be missing them I don't know. Would reinstalling Excel
or Office XP Pro help?

Thanks for the assistance.

Doc
 
Doc,
Why the Activate method? The Select method works fine.
You didn't mention before that "Select" worked??
There shouldn't be much of a difference (obviously, for your
workbook, there is though).
Are there any libraries I could be missing?
Probably not. If they don't show up as "Missing" on the References
list, Excel didn't try to use one and not find it.
Would reinstalling Excel or Office XP Pro help?
Again, probably not.

I don't have 2002 or XP at home (I do in the office).
If you could forward me the file directly, I'll take a look at it
tomorrow.

John
 
Back
Top