Make 'Windows(workbook.xls).Activate' Generic

  • Hello,


    How do I structure a VBA routine to make the statement below apply to any workbook. The code needs to execute the 'Windows(example.xls).Activate' statement when run from other workbooks where the workbook name will be predefined, but will vary from case to case. In all cases the macro would be run from the subject workbook.


    Code
    Sub Test()
    Windows("Example.xls").Activate
    End Sub


    Many thanks,


    Hank

  • Re: Make 'Windows(workbook.xls).Activate' Generic


    Hi,


    if the windows is shown always in the same order and the same number this can be a solution:


    Code
    windows(0).activate


    or


    Code
    windows(1).activate


    depending on which one you want.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!