Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 249
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 249
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 249
Default 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I force my code to wait saita Excel Programming 2 September 30th 05 02:27 AM
Wait for Pivot Refresh before continuing Code Execution Dan Excel Programming 0 May 11th 05 06:12 PM
is there a code to wait? choice[_2_] Excel Programming 1 January 8th 05 06:47 AM
wait for user action in VBA code benb Excel Programming 4 September 24th 04 09:05 PM
VBA Code to wait 50-150 mS Hotbird[_2_] Excel Programming 2 December 31st 03 09:15 PM


All times are GMT +1. The time now is 01:56 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"