Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Excel and more than 1 workbook
#1
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
#2
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     Help - how to add the trigger to the macro
Code:
Copy      Help
;one and two is window name
act "one"
;enter code here

act "two"
;enter code here
#3
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
Code:
Copy      Help
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.
#4
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
#5
Quote:Is this what this question is covering?

No.

this activates a worksheet
Macro Macro633
Code:
Copy      Help
ExcelSheet es.Init("Sheet3" 1)


Forum Jump:


Users browsing this thread: 1 Guest(s)