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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Variable Declarations - Compile Error 1

Status
Not open for further replies.

Stretchwickster

Programmer
Apr 30, 2001
1,746
GB
Hi People,

I've had to pick up a 4 year-old Excel worksheet that contains some VBA. I'm using Excel 2003. I've not had to touch VBA for a few years now, so I'm a bit rusty and consequently this question can probably be easily answered.

I have the following two lines in the top of a VBA module, both of which produce a "Compile error: User-defined type not defined".
Code:
Dim cBar As CommandBar
Dim SelectionBox As CommandBarComboBox
From reading the help file on this error, it looks like Excel is not recognising the "CommandBar" and "CommandBarComboBox" data types. Presumably, I'm missing the reference that defines these types, so I've tried looking these up on MSDN to see if I could find what reference is required but I was getting a bit lost.

I currently have the following References checked:
- Visual Basic For Applications
- Microsoft Excel 11.0 Object Library
- OLE Automation

Any pointers would be greatly appreciated!

Clive
Runner_1Revised.gif

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer." (Paul Ehrlich)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096
 
Add the following reference:
Microsoft Office 11.0 Object Library

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
The list of References was so long I didn't know where to start looking! Thank you very much PH.

Clive
Runner_1Revised.gif

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer." (Paul Ehrlich)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top