Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default VBA code executes fine, but compiler throws error. Huh?

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.

***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default VBA code executes fine, but compiler throws error. Huh?


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)





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.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default VBA code executes fine, but compiler throws error. Huh?

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.

***
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBS Script and ClearContents -- Code Throws An Error garibaldi Excel Programming 4 November 15th 07 03:45 AM
Compiler Error Bobzter100 Excel Discussion (Misc queries) 4 November 10th 07 11:02 AM
Code that executes against any Excel file Steve[_91_] Excel Programming 1 August 16th 07 12:03 PM
[Q] Save As throws type mismatch error in control's code? Jason Weiss Excel Discussion (Misc queries) 1 July 16th 05 04:21 AM
SAveAs executes combobox code Alan Lyall Excel Programming 3 June 9th 04 12:52 AM


All times are GMT +1. The time now is 09:31 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"