Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Macro - wait while it runs

665 views
Skip to first unread message

David Harbour

unread,
Nov 19, 2001, 11:03:17 PM11/19/01
to
I need to pause my macro while it preforms one action before it starts up
the next action. I am pretty sure there is no way I can do it without
running some code - the problem is I am VB illiterate.

Can someone help me out - this is driving me insane.

Thanks


nal

unread,
Nov 20, 2001, 3:49:11 AM11/20/01
to
I wonder if . . .
You create a module and add the following code:

Function CompleteActions()
DoEvents
End Function

Then in your macro, have a line which uses the RunCode command, and in the
Function Name have CompleteActions()

How appropriate this is will depend rather on what you are trying to do.

nal

"David Harbour" <David,Har...@Compaq.com> wrote in message
news:cCkK7.1741$RL6....@news.cpqcorp.net...

grelbr

unread,
Nov 20, 2001, 9:47:45 AM11/20/01
to
"David Harbour" <David,Har...@Compaq.com> wrote in message news:<cCkK7.1741$RL6....@news.cpqcorp.net>...

Urhm. Don't macros just naturally do that anyway? Each step finishes
before the next one starts. Of course, it may be you are seeing some
funny business with screen updates being delayed. Check the thread
with subject "Order of precedence when executing code" on this very
news group.

Do you want the user to have to click something to start it going
again? Then a message box would likely do. Look up msgbox. But
keep in mind that, while the message box is open, it's not doing
anything else.
grelbr

David Harbour

unread,
Nov 20, 2001, 8:41:10 PM11/20/01
to
I have two problems,
1. From Access, I am trying to start a BAT file that opens an Auto_open
macro in Excel to do some things before saving the file for Access to import
(which is the next step in the Access Macro). Access will start the BAT file
but then immediately step into importing the file before Excel is done.
Hummm....maybe I can tweak the BAT file to open Access after Excel does it's
thing - that way I start with the BAT file and bypass the problem with
Access. Another problem is that I pretty much maxed out my BAT knowledge
doing what I did to get it to open Excel.

Problem 2. I was trying to use the RunCommand Replace function in a Macro
with a Sendkeys statement to remove some info from one of my fields. - after
which I would start my queries a-querying. But Access will SendKeys to the
Replace dialog box, then thinking it is done, Access jumps to the next
action before the all important Replace has taken place. I need about a 10
second buffer (some kind of counter) that will hold off executing the next
action while the Replace is in progress. I got around this via the Excel
macro mentioned above so this is not an issue anymore but I still want
something in Access that I can use for a little breather between tasks.

If someone could create an Access funtion that would allow the lite-user
like myself to specify a wait time in the macro I would give them a big
thank you and a dollar thrity-four in change(minus postage of course).


"grelbr" <gre...@hotmail.com> wrote in message
news:1a325379.01112...@posting.google.com...

grelbr

unread,
Nov 21, 2001, 2:43:05 PM11/21/01
to
"David Harbour" <David,Har...@Compaq.com> wrote in message news:<ZCDK7.1786$RL6....@news.cpqcorp.net>...
[snip]

> If someone could create an Access funtion that would allow the lite-user
> like myself to specify a wait time in the macro I would give them a big
> thank you and a dollar thrity-four in change(minus postage of course).
[snip]

Ok, this *might* be what you want. Look up "Timer Function" then look
at the example in the Access online helps.

Though, that might not be what you want. It seems you really want
some way of sending messages between Access and Excel. There are
a bunch of ways you could do that. For example, you could arrange
a file some place. You could have your bat file create it and copy
some agreed content into it. You could have Excel do its thing
and when done, empty the file. You could have Access check that
file once per second until it's empty. Then you could go on.
grelbr

Richard Bernstein

unread,
Nov 22, 2001, 8:40:52 AM11/22/01
to
If you know VBA, you can run Excel from Access using Automation.

MacroStep
RunCode -- AutomationFunction()
MacroNextStep

Access retains control of the order of execution. Of course, you'll
have to also convert whatever Excel was doing to VBA.

Richard Bernstein

Terry Liston

unread,
Nov 23, 2001, 12:19:30 AM11/23/01
to
You could try a function something like this. (Put this function in a
module) It pauses on my machine (PIII-450) for about 5 seconds. To increase
the time, just change the value. (Add a zero in the middle somewhere, and
time it.) Use the RunCode macro command, and put the function name in it.

Function Pause5s()

For I = 1 To 35000000#
Next I

End Function

"grelbr" <gre...@hotmail.com> wrote in message
news:1a325379.01112...@posting.google.com...

0 new messages