+ Reply to Thread
Results 1 to 6 of 6

Code Doesn't Wait!

  1. #1
    targante
    Guest

    Code Doesn't Wait!

    Window NT; Excel 97
    1. I have a VBA procedure that uses DOS to create a directory listing file,
    then it accesses the file. But, the code "beats" DOS, and tries to access
    the file before DOS finishes creating it.
    How do I get the code to wait for DOS to finish?

    2. This same dilemma applies to having a VBA procedure open a workbook,
    execute several actions, then close the file. The procedure beats itself and
    closes the workbook before it's finished making the changes.
    How do I get the code to wait for itself to finish before closing?

    Thanks,
    Trent Argante
    [TPA.J(67)]

  2. #2
    Dave Patrick
    Guest

    Re: Code Doesn't Wait!

    Give this a go or look at the Run method of VBScript.

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

    --
    Regards,

    Dave Patrick ....Please no email replies - reply in newsgroup.
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    http://www.microsoft.com/protect

    "targante" wrote:
    | Window NT; Excel 97
    | 1. I have a VBA procedure that uses DOS to create a directory listing
    file,
    | then it accesses the file. But, the code "beats" DOS, and tries to access
    | the file before DOS finishes creating it.
    | How do I get the code to wait for DOS to finish?
    |
    | 2. This same dilemma applies to having a VBA procedure open a workbook,
    | execute several actions, then close the file. The procedure beats itself
    and
    | closes the workbook before it's finished making the changes.
    | How do I get the code to wait for itself to finish before closing?
    |
    | Thanks,
    | Trent Argante
    | [TPA.J(67)]



  3. #3
    targante
    Guest

    Re: Code Doesn't Wait!

    Dave, this article answered the first dilemma, so thank you.
    But, I still need a solution for the second

    "Dave Patrick" wrote:

    > Give this a go or look at the Run method of VBScript.
    >
    > http://support.microsoft.com/kb/q129796/
    >
    > --
    > Regards,
    >
    > Dave Patrick ....Please no email replies - reply in newsgroup.
    > Microsoft Certified Professional
    > Microsoft MVP [Windows]
    > http://www.microsoft.com/protect
    >
    > "targante" wrote:
    > | Window NT; Excel 97
    > | 1. I have a VBA procedure that uses DOS to create a directory listing
    > file,
    > | then it accesses the file. But, the code "beats" DOS, and tries to access
    > | the file before DOS finishes creating it.
    > | How do I get the code to wait for DOS to finish?
    > |
    > | 2. This same dilemma applies to having a VBA procedure open a workbook,
    > | execute several actions, then close the file. The procedure beats itself
    > and
    > | closes the workbook before it's finished making the changes.
    > | How do I get the code to wait for itself to finish before closing?
    > |
    > | Thanks,
    > | Trent Argante
    > | [TPA.J(67)]



  4. #4
    Dave Patrick
    Guest

    Re: Code Doesn't Wait!

    Without looking at it I have no idea.

    --
    Regards,

    Dave Patrick ....Please no email replies - reply in newsgroup.
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    http://www.microsoft.com/protect

    "targante" wrote:
    | Dave, this article answered the first dilemma, so thank you.
    | But, I still need a solution for the second



  5. #5
    Trent Argante
    Guest

    Re: Code Doesn't Wait!

    I was wrong. It didn't work for the first either. The code example in the
    article worked instead of using shell "notepad.exe, but not for shell "dir >
    listing.txt".
    Any ideas?

    "Dave Patrick" wrote:

    > Without looking at it I have no idea.
    >
    > --
    > Regards,
    >
    > Dave Patrick ....Please no email replies - reply in newsgroup.
    > Microsoft Certified Professional
    > Microsoft MVP [Windows]
    > http://www.microsoft.com/protect
    >
    > "targante" wrote:
    > | Dave, this article answered the first dilemma, so thank you.
    > | But, I still need a solution for the second
    >
    >
    >


  6. #6
    Dave Patrick
    Guest

    Re: Code Doesn't Wait!

    These may help if you don't want to use a scripting solution.

    http://www.freevbcode.com/ShowCode.Asp?ID=99
    http://www.freevbcode.com/ShowCode.Asp?ID=99

    http://msdn.microsoft.com/library/de...l/wsmthrun.asp

    --
    Regards,

    Dave Patrick ....Please no email replies - reply in newsgroup.
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    http://www.microsoft.com/protect

    "Trent Argante" wrote:
    |I was wrong. It didn't work for the first either. The code example in the
    | article worked instead of using shell "notepad.exe, but not for shell "dir
    >

    | listing.txt".
    | Any ideas?



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1