Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
cannot activate window
#1
Hi, Im new at QM:

I can't activate a window with the act win command, but i can, when the program have the control of the window, don't know if explain myself.
i have this code:

ifi win("Microsoft Excel - BOOK1")
act win("Microsoft Excel - BOOK1")
else
act win("BOOK1")

The BOOK1 obviusly exists, and, when Excel controls it, it works properly and activates the BOOK1, but, when Excel has control of another book but BOOK1 still exists, it can't activate the BOOK1 and gets this error:

Error (RT) in Macro2: cannot activate window

I guess this is easy cake for the programmers around here, so please tell me what to do to fix this thing.

Lots of thx in advance
#2
Actually Excel displays Book1 and Book2 in the same window. When Book2 is displayed, it creates another window with name Book1. That window is not visible but shows a button in the taskbar. When act tries to activate it, Excel instead displays Book1 in the main window, and the invisible window remains inactive. QM waits for a while and generates error. Use this instead:

Code:
Copy      Help
AllowActivateWindows
SetForegroundWindow(win("Book1"))
#3
Oh thank u very much, that helped me a lot. I managed to solve it, but with a bunch of sentences hehe.
#4
I tried the above method; it works and sets to foreground the second excel workbook.
However, I am unable to get the first one activated after that.
Any clues?
Best Regards,
Philip
#5
Macro Macro2443
Code:
Copy      Help
ExcelSheet es.Init
es.Activate(2|4 "" "Book3.xls")


Forum Jump:


Users browsing this thread: 1 Guest(s)