Halt Macro on Error

S

SusanV

I have an autoexec macro that calls multiple public functions. The first
function requires the user to select excel files which become the basic
tables via transferspreadsheet. If they select the wrong files, the function
bombs. I added error handling for the GetData function to throw up an error
box and exit function, but the macro continues running, and now the NEXT
function bombs because the data is not what is expected. Users still get the
define field and Macro halt dialog boxes (which of course throws them into a
panic, lol)

How can I not only exit the function which errored, but also halt the macro
itself?

<going around in circles trying to fix errors in my error handling!!!>

TIA,

SusanV
 
S

SusanV

For anyone interested, I gave up on the autoexec macro as a bad job, instead
I am using a form for startup which calls the GetData function. At the end
of that function I call the rest of the functions, allowing for proper
error-handling.

Stupid macros, whenever I try to save time using them it takes me longer
overall to get the job done!


;-D

Susan
 
V

Van T. Dinh

Susan

One of the major problems of Macros is that there is no facility to trap
errors. I haven't used Macros since Access95 except for AutoKeys Macro and
generally, the Macro will only use the RunCode action to run VBA code.

Microsoft have been saying that Macros may not be supported in the future so
I avoid Macros and the only one I use is the AutoKeys Macro.
 
S

SusanV

Thanks for the feedback Van, I avoid using them for the most part myself,
although it is a quick way to get a bunch of process steps ordered and into
code. Convert to VB... nice little time saver when I can't remember syntax!

;-D

Susan
 
S

Steve Schapel

Susan,

It is also several years since I used macros myself, for various
reasons. On the other hand, they provide a wonderful solution for many
people in many situations. But one thing they are *not* good for, in my
opinion, is a stepping stone to VBA. Choose one or the other. Whereas
it is true there is the "Convert macros to VB" facility, in practice the
VBA code produced by this wizard is always ugly, usually awkward, and in
the case of some complex macros, it just can't handle it at all.
 
S

Steve Schapel

Van,
Microsoft have been saying that Macros may not be supported in the future ...

Really? I find this astounding. Can you point me to where you have
seen this?
 
S

SusanV

Yes - please! Most of the macros I use when doing a "convert to code" are
simple compilations of RunQuery and OutputTo and I haven't had any trouble
other than the error handling stuff (which I'm still struggling to learn how
to do properly - by the way, any good resources for this piece?)

Susan
 
V

Van T. Dinh

I am sure I read this long time ago, possibly in A95 or A97 Help.

I see if I can resuurect my old computer and check A95 / A97 Help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top