ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA codes for macro to continue (https://www.excelbanter.com/excel-programming/329836-vba-codes-macro-continue.html)

brian

VBA codes for macro to continue
 
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



Vasant Nanavati

VBA codes for macro to continue
 
VBA does not directly support an indefinite pause. Could you clarify exactly
what you are trying to do?

--

Vasant

"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





Mark Dev[_2_]

VBA codes for macro to continue
 
Brian,

I agree with Vasant. We need a little more information about why you're
trying to delay the execution of the macro.

Are you saying that you want to click a button that will halt the macro, and
then click it again when you want to resume?
I don't know about clicking a button, but you can just press CTRL-BREAK,
which will halt the code in it's tracks, then press F5 to resume when you're
ready. This will also allow you to look at the results on the worksheet so
far.

Mark

"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




brian

VBA codes for macro to continue
 
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




Vasant Nanavati

VBA codes for macro to continue
 
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 ;-).



"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






brian

VBA codes for macro to continue
 

"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








Vasant Nanavati

VBA codes for macro to continue
 
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










brian

VBA codes for macro to continue
 
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












Vasant Nanavati

VBA codes for macro to continue
 
I'm sorry; I think someone who knows Excel 4 macros better than I do is
going to have to help you with this. I don't know/remember how to call part
of an Excel 4 macro from a button in a newer Excel version.

--

Vasant



"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














Tom Ogilvy

VBA codes for macro to continue
 
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














brian

VBA codes for macro to continue
 
Thank you for trying.

Brian

"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message
...
I'm sorry; I think someone who knows Excel 4 macros better than I do is
going to have to help you with this. I don't know/remember how to call
part
of an Excel 4 macro from a button in a newer Excel version.

--

Vasant



"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
















brian

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

















All times are GMT +1. The time now is 10:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com