View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default VBA has "lost" some datatypes

These items are defined in the Office type library. It sounds like you have
lost your reference to that library. In Tools=References in the VBE, make
sure now libraries are shown as missing and create a reference to the office
type library.

--
Regards,
Tom Ogilvy

"MWE" wrote in message
...
I am running Excel2000 under WindowsXP. I have dozens of
Excel applications with VBA. Suddenly, they are all
failing with various "data type not defined" errors. VBA
seems to have lost its understanding of some datatypes it
is supposed to support. For example, a general menu
building subroutine that has been running flawlessly for
several years uses several standard datatypes; relevant
DIM statements a

Dim HelpMenu As CommandBarControl
Dim NewMenu As CommandBarPopup
Dim MenuData As String

When this routine is called, the first statement now fails
with a reference to an undefined user-defined Type. To me
this means that VBA thinks CommandBarControl is a user
defined type and not a standard type.
If I comment out the first Dim statement and run the
routine again, if fails with the same error message now on
the 2nd line. If I comment out the 1st and 2nd lines, the
routine runs (it understands the String datatype) until it
fails because the HelpMenu and NewMenu objects are not
understood.

I reinstalled Excel but the problem persists.

Any help would be greatly appreciated.