Identifying current window

  • Thread starter Thread starter Don
  • Start date Start date
D

Don

How can I change the statement below to use the name of the workbook running
the macro rather than the hardcoded workbook name in that statement?

Windows("workbook_a.xls").Activate

Don

P.S. The above statement is from a macro that I recorded that I want to
change. I know nothing about VB or writing macros. I generally record macros
and than make small changes to fine tune them to my needs.
 
Instead of going through the windows collection, you could do:

Thisworkbook.activate

If you have multiple windows into the same workbook, then this kind of thing:

windows(thisworkbook.name).activate

will fail.
 
Thank you.

Dave Peterson said:
Instead of going through the windows collection, you could do:

Thisworkbook.activate

If you have multiple windows into the same workbook, then this kind of
thing:

windows(thisworkbook.name).activate

will fail.
 
Back
Top