I have a button that should "activate" (or set focus to) my Quickbooks application. I have hardcoded the title bar caption into the appactivate function and yesterday it worked just fine. Today it would not, but I realized why. The title bar of my QuickBooks application changes depending on user logged on and mode (multi-user/single-user). I have searched around for alternatives for a workaround, but have come up short handed. Is there any way to retreive the tital bar caption of the QuickBooks application beforehand and then use that title in the appactivate function?
I have tried some of the following, but no luck...
Looked into the FindWindow API function, but just couldn't grasp the understanding of it, plus unless I am wrong, I needed the title bar caption of that anyway.
I used the shell() function to get the appID and send the appId to the appactivate function, but that did not work either. The reason i believe is because QuickBooks will ALWAYS already be running before my appactivate function is called, and using the shell() appears like it is opening another copy (according to my task bar) of Quickbooks then realizing a copy is already open so shuts that "second copy" down, essentially giving the wrong appID.
Any other suggestions?
What I have so far:
I have tried some of the following, but no luck...
Looked into the FindWindow API function, but just couldn't grasp the understanding of it, plus unless I am wrong, I needed the title bar caption of that anyway.
I used the shell() function to get the appID and send the appId to the appactivate function, but that did not work either. The reason i believe is because QuickBooks will ALWAYS already be running before my appactivate function is called, and using the shell() appears like it is opening another copy (according to my task bar) of Quickbooks then realizing a copy is already open so shuts that "second copy" down, essentially giving the wrong appID.
Any other suggestions?
What I have so far:
Code:
[COLOR=seagreen]'Sets focus to the quickbooks window[/COLOR]
Dim appID As String
appID = Shell("C:\Program Files\Intuit\QuickBooks 2008\QBW32Pro.exe", 1)
AppActivate appID [COLOR=seagreen]' the hard code that changes:"Quickbooks Pro 2008[/COLOR](multi-user)(Joe)"