|
-
Aug 8th, 2005, 06:12 AM
#1
Thread Starter
New Member
Waiting while other program is busy
Hi There,
Thanks in advance for any help. Here is my problem:
I am running a VBA script that opens another application (using appactivate shell.......). The application creates a report and takes a varying amount of time to run. I don't want to use a delay as sometimes it runs the report quickly and other times it takes several minutes. When it becomes idle, I'd like to close it.
I could use the Shell and Wait routine but the window remains open when it has finished processing.
Is there a way that I can tell if the application is no longer busy so I can execute the code to close it(which I know how to do) and then continue on with the rest of the VBA script?
Readystate complete can be used for some things but can it be used for shelled Apps?
I've trawled the net for hours but can't seem to find any answers!
Thanks again.
-
Aug 8th, 2005, 06:17 AM
#2
Re: Waiting while other program is busy
Two questions
Inside which application is the VBA Code?
What is the application that you are trying to control?
Danny
Never Think Impossible
If you find my answer helpful then please add to my reputation
-
Aug 8th, 2005, 06:26 AM
#3
Thread Starter
New Member
Re: Waiting while other program is busy
Thanks Danny for the quick reply.
The VBA Code is inside Excel at the moment.
The application I'm trying to control is one we use at work. It is not a microsoft application, it is made by a third party and it is used to generate reports. It is an .exe that i run.
-
Aug 8th, 2005, 06:30 AM
#4
Re: Waiting while other program is busy
Does it have any includable references that could be used inside VBA?
Danny
Never Think Impossible
If you find my answer helpful then please add to my reputation
-
Aug 8th, 2005, 06:45 AM
#5
Thread Starter
New Member
Re: Waiting while other program is busy
I'm sorry, I dont know what that is. Can you give me an example?
-
Aug 8th, 2005, 06:50 AM
#6
Re: Waiting while other program is busy
An includable reference is what is know as an Object Library(DLL or TLB).. You can include these references inside your VBA Project to expose properties and methods of the program which VBA can control.
If there is nothing, then I suggest you either go back to the third party to see if they can help you with this, or you will need to look into API calls for this.
Danny
Never Think Impossible
If you find my answer helpful then please add to my reputation
-
Aug 8th, 2005, 06:58 AM
#7
Thread Starter
New Member
Re: Waiting while other program is busy
Ah,OK. I've tried that and there are not. I've searched for two days now for API Calls.
Do you know of an API call that can return an Applications CPU Usage (as in the task manager). I could keep checking until it retunrs to zero, that would sort me staight out.
Thanks for your help
-
Aug 8th, 2005, 07:28 AM
#8
Re: Waiting while other program is busy
You could try CloseHandle from www.allapi.net
Danny
Never Think Impossible
If you find my answer helpful then please add to my reputation
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|