Re: How to force Excel to complete one statement before executing

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Nick - Excellent! Thank you. Thats exactly what I wanted to know.

I do not want to use the Application.wait statement as a 10 second / 30
second delay would make my customers feel that I am doing a sloppy job in my
code.

How I can use API calls to connect to the File Server instead of using this
Shell statement to do the same?

Thank you so much.

Regards,
Ravi

"Nick Hodge" wrote:

> You cannot stop Excel from executing the next line as the Shell function
> runs asynchronously.
>
> You could use Application.Wait so you put a delay in that would ensure,
> barring crashes that the application was open, e.g (30 sec delay)
>
> Application.Wait(Now + TimeValue("0:00:30"))
>
> I supect you could use an API call but this could be a complicated route
>
>
> --
> HTH
> Nick Hodge
> Microsoft MVP - Excel
> Southampton, England
> nick_hodgeTAKETHISOUT@xxxxxxxxxxxxxxxxx
>
>
> "vrk1" <vrk1@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:44ADE79E-508C-44B0-A193-EB18580199AC@xxxxxxxxxxxxxxxx
> > This is my problem:
> >
> > I have two lines of statement in my VBA code as follows:
> >
> > __________________________________________
> > line1: Shell("net use \\fs1\ipc$")
> >
> > line2: Set db = OpenDatabase("\\fs1\test\abc.mdb", False, True, "MS
> > Access;PWD=12345")
> >
> > Other lines follow here....
> > _________________________________________
> >
> > When I execute the VBA code, sometimes I get a handle to the database and
> > sometimes I dont (I get a runtime error 3051 because there is a delay in
> > getting the handle to the database due to slow network).
> >
> > When I debug this line by line, I dont get any error message.
> >
> > I want to make Excel complete executing LINE1 (however long it takes on a
> > slow network) and then execute LINE2 . How do I make Excel do this?
> >
> > I have been researching on this for the last 3 days. If anyone here can
> > help me on this, this would be of great help to me! Thanks in Advance!
> >
>
>
>
.



Relevant Pages

  • UbuntuLiveChatSupport Testers Needed.
    ... in ubuntu-users. ... Automatically set the nickname entry, ... Delay time can change dynamically, this release fixes by capturing the ... to use automated registration system, ...
    (Ubuntu)
  • Re: UbuntuLiveChatSupport Testers Needed.
    ... A new channel will be autojoined based on language. ... the default top channels tab and alternative left channels tab. ... Automatically set the nickname entry, ... Delay time can change dynamically, this release fixes by capturing the ...
    (Ubuntu)
  • Re: UbuntuLiveChatSupport Testers Needed.
    ... the default top channels tab and alternative left channels tab. ... Automatically set the nickname entry, ... Delay time can change dynamically, this release fixes by capturing the ... the gnome-panel one will not install due to gnome-data version ...
    (Ubuntu)
  • Re: UbuntuLiveChatSupport Testers Needed.
    ... A new channel will be autojoined based on language. ... the default top channels tab and alternative left channels tab. ... Automatically set the nickname entry, ... Delay time can change dynamically, this release fixes by capturing the ...
    (Ubuntu)
  • Exporting using Access2000 runtime
    ... I have a database with a small piece of vba code to export ... a query to a text file. ... Nick ...
    (microsoft.public.access.externaldata)