Posts: 128
Threads: 48
Joined: Jan 2007
Hello,
can somebody help me with this, i searched for it but can't find it and not capable of solving it myself..
I opened excel with 2 different workbooks... ag "one" "two"
How is it possible to start a macro and always activate excel and the "two" workbook?
everytime i opened the macro and the workbook is not the active workbook, it stopped with a message like it cannot find the workbook....
any help appreciated
freggel
Posts: 67
Threads: 24
Joined: Feb 2009
freggel99 Wrote:Hello,
can somebody help me with this, i searched for it but can't find it and not capable of solving it myself..
I opened excel with 2 different workbooks... ag "one" "two"
How is it possible to start a macro and always activate excel and the "two" workbook?
everytime i opened the macro and the workbook is not the active workbook, it stopped with a message like it cannot find the workbook....
any help appreciated
freggel
Function
Dialog2
Trigger
F4
;one and two is window name
act "one"
;enter code here
act "two"
;enter code here
Posts: 12,073
Threads: 140
Joined: Dec 2002
Excel has 1 main window and a hidden window for each workbook. When act is used to activate a currently inactive workbook, it finds the hidden window, tries to activate it, and ultimately gives error because Excel does not allow to activate the hidden window. Excel instead activates the main window and displays the workbook in it.
To activate Excel workbooks, use code like this:
Macro
act win("Excel" "XLMAIN") ;;activate the main window. Use this because act does it better than SetForegroundWindow.
SetForegroundWindow win("workbook name.xls") ;;try to activate the hidden window. Unlike act, this code does not give error.
Posts: 9
Threads: 3
Joined: Aug 2008
Now in each workbook you can have multiple tabs. Is this what this question is covering? If so, I was unable to select the correct tab using this code.
e.g. Proposal1 - Proposal2 - Proposal3, Each of which have their own tab but are in the same workbook.
Thanks for your time.
Best Regards,
px
Posts: 12,073
Threads: 140
Joined: Dec 2002
Quote:Is this what this question is covering?
No.
this activates a worksheet
Macro
Macro633
ExcelSheet es.Init("Sheet3" 1)