Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2008

Tip: Looking for answers? Try searching our database.

VBA code executes fine, but compiler throws error. Huh?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
baobob@my-deja.com - 17 Jan 2008 17:20 GMT
I continue to have severe problems with Excel 97 SR2 crashing while
editing, compiling & running VBA.

I DO promise to upgrade soon. But meanwhile:

On relaunching Excel after its last crash, all code runs fine but the
compiler throws an error.

On selecting Debug / Compile VBAProject, error "User-defined type not
defined" appears. Nor does the compiler highlight in its usual yellow
what line is causing this supposed error.

I have three modules and they're all intact. If I deliberately make a
syntax error anywhere, execution then correctly chokes and stops on
the offending line.

Does anyone recognize this problem & how to fix it?

(And more basic Q: Why doesn't Excel's left hand know what its right
hand is doing?)

Thanks much.

***
Jim Cone - 17 Jan 2008 18:04 GMT
Excel 97 has a better help file than any of the later versions.
XL2000 has particularly bad help file.
Excel 97, in general, is faster than anything that came after.
However, MS has stopped releasing security fixes for Excel 97.
It is difficult to find the words to express my true feelings about xl2007.

As for your compile problem...
It sounds as if you are not using "Option Explicit" as the first line in each module.
If that is the case, you could have simply misspelled a word in your code,
leaving XL to think it is a custom Type declaration.

I saw a recent post where the same error was generated by spelling Variant as varaint.

Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)

<baobob@my-deja.com>
wrote in message
I continue to have severe problems with Excel 97 SR2 crashing while
editing, compiling & running VBA.
I DO promise to upgrade soon. But meanwhile:
On relaunching Excel after its last crash, all code runs fine but the
compiler throws an error.
On selecting Debug / Compile VBAProject, error "User-defined type not
defined" appears. Nor does the compiler highlight in its usual yellow
what line is causing this supposed error.
I have three modules and they're all intact. If I deliberately make a
syntax error anywhere, execution then correctly chokes and stops on
the offending line.
Does anyone recognize this problem & how to fix it?
(And more basic Q: Why doesn't Excel's left hand know what its right
hand is doing?)
Thanks much.
baobob@my-deja.com - 19 Jan 2008 07:48 GMT
Jim:

Thanks very much for reply.

Well, I have 3 modules, and yes, those 2 that I've been mucking with
do have 'Option Explicit'. The 3rd module that I haven't touched only
contains a bunch of one-line UDFs that are macro keystroke shortcuts
for changing font, color. But thanks to your reminder, I added 'Option
Explicit' to it too.

***

But in the meantime, I've changed to my other PC with Excel 2002 on
it, and the error is still occurring, but in the reverse: My VBA
compiles fine, but I'm getting that 'User-defined function not
defined' message while out in the workbook, when I exit certain cells
that contain calls to my UDFs. But the error displays only
sporadically (meaning when the compiler, or whatever it is that's
throwing the error, has to search beyond a cache of some sort....?
Just an idle hypothesis.)

Anyway, I'll create another thread for this problem if necessary.

***

Your remarks re. Excel 97 are very interesting. Yes, Excel 97's Help
seems very good, and I've always liked it.

I absolutely LOATHE Angel Soft's later Help paradigm, where you, like,
type in one or more keywords, then get some results, then try find in
those results what you're looking for. Everyone I know has been
puzzled by why most (and sometimes all) of those results are
completely off-topic, and worse are (or at least last time I looked,
which could be a few yrs.) not even alphabetized. I mean, huh?

I find one and only one kind of help interface really usable: a simple
index of all the topics, functions, keywords, etc. that the
application contains.

Well, thanks again.

***
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.