View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.programming
brian brian is offline
external usenet poster
 
Posts: 22
Default VBA codes for macro to continue

Much appreciate your suggestion, Tom. It gives me a glimmer of hope that it
may work. But how do you go about to incorporate its VBA codes in Office
Excel 2003? Am not familiar with VBA but I'm an old-time user of Excel4
macros.

Brian


"Tom Ogilvy" wrote in message
...
Try using the Excel4 macro command RESUME: (assign your button to code
that
executes this command)

Equivalent to choosing the Resume button on the toolbar. Resumes a paused
macro. Returns TRUE if successful or the #VALUE! error value if no macro
is
paused. A macro can be paused by using the PAUSE function or choosing
Pause
from the Single Step dialog box, which appears when you choose the Step
Into
button from the Macro dialog box.

Syntax

RESUME(type_num)

Type_num is a number from 1 to 4 specifying how to resume.

Type_num How Microsoft Excel resumes

1 or omitted If paused by a PAUSE function, continues running the macro.
If
paused from the Single Step dialog box, returns to that dialog box.
2 Halts the paused macro
3 Continues running the macro
4 Opens the Single Step dialog box

Tip You can use Microsoft Excel's ON functions to resume based on an
event.
For an example, see ENTER.DATA.

Remarks

If one macro runs a second macro that pauses, and you need to halt only
the
paused macro, use RESUME(2) instead of HALT. HALT halts all macros and
prevents resuming or returning to any macro.
If the macro was paused from the Single Step dialog box, RESUME returns to
the Single Step dialog box.

--
Regards,
Tom Ogilvy

"Brian" wrote in message
...
As I use several other Excel 4 macro programs, I don't want to delete
this
tool-bar as mentioned in your suggested article. I can physically create

or
customize my own tool-bar and place a command button in it. I don't need

the
"pause". What I need is a set of VBA codes "to resume" after the pause.

This
then will allow me to use other similar Excel 4 macro programs under

Office
Excel 2003 environment. Can you tell me where I can find this
information?
Thanks.

Brian


"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message
...
Brian, I think I understood quite well what you were asking. Here's
what
Microsoft says, although the terminology might be out of date now:

"In Visual Basic, Applications Edition, there is no built-in equivalent
for
the MS Excel 4.0 PAUSE() macro function. The Visual Basic code in this
article provides an alternative.

"You might want to use this code to pause execution of your macro while

a
user enters data directly in a sheet or manipulates menus."

.................................................. ....................

"If you have a single procedure within which you need to pause
execution
until the user desires to resume execution, split your sub procedure

into
two halves."

http://support.microsoft.com/kb/q131847/

--

Vasant

"Brian" wrote in message
...

"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message
...
Perhaps you could split the macro into two, and run the second part

on
the
button click. I honestly don't remember much about the old macros
any
more
... the memory is going ;-).

Nooooo! You misunderstood what I am trying to tell you. I'm not asking
for
the old macro codes. They work fine under older version of Excel. The
program even runs ok under Office 2003 Excel. All I'm after is a new
button
assigned to a new set of VBA codes running Office 2003 Excel, that

tells
the
program to continue with its macro execution. If you now re-read my
original
post it will make sense.

Brian





"Brian" wrote in message
...
Hi Vasant/Mark

I'm trying to use an older Excel (.xlm) macro program which works

fine
with
MS Office 2003 Excel, except after the point where the program

pauses
to
accept user inputs (like name, date, etc.). To continue, the user

then
activates the continue button to enable the program to complete its
execution. This button now doesn't work as the current version of
Excel
doesn't understand it. Can you outline for me the new command

code(s)
to
assign this button to, or another way around it other than the long
way
as
suggested below? Thanks.

Brian

One suggestion:
Add this line to the program after "=Pause()":
=Activate("XYZ.xls") (replace XYZ with the worksheet name)
Then execute, ToolsMacroMacros....Run (from that line)



"Brian" wrote in message
...
Am not a programmer. I would like to create a button so that the
running
macro will continue after a pause. Can someone help me with just
that
few
lines of codes.

TIA
Brian