Results 1 to 8 of 8

Thread: Waiting while other program is busy

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2005
    Posts
    4

    Angry 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.

  2. #2
    Fanatic Member dannymking's Avatar
    Join Date
    Jul 2005
    Location
    Darlington, North East UK
    Posts
    677

    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

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2005
    Posts
    4

    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.

  4. #4
    Fanatic Member dannymking's Avatar
    Join Date
    Jul 2005
    Location
    Darlington, North East UK
    Posts
    677

    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

  5. #5

    Thread Starter
    New Member
    Join Date
    Aug 2005
    Posts
    4

    Re: Waiting while other program is busy

    I'm sorry, I dont know what that is. Can you give me an example?

  6. #6
    Fanatic Member dannymking's Avatar
    Join Date
    Jul 2005
    Location
    Darlington, North East UK
    Posts
    677

    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

  7. #7

    Thread Starter
    New Member
    Join Date
    Aug 2005
    Posts
    4

    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

  8. #8
    Fanatic Member dannymking's Avatar
    Join Date
    Jul 2005
    Location
    Darlington, North East UK
    Posts
    677

    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
  •  



Click Here to Expand Forum to Full Width