I want to switch between windows in a macro, but want to identify the window by file name rather than "windows(1).activate". The number assigned to the window varies, and I want the window switch to be specific. How can I do this? TIA
You do it using the window caption, which is normally the same as the document name (without the .doc on the end).
Enjoy,
Tony
-------------------------------------------------------------------------------------------- We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at [url=http://www.vbaexpress.
I have a two documents open at the moment - one is called "A4 TIMETABLE.doc" and the title bar says "A4 TIMETABLE - Microsoft Word" - it is Windows(1) and Windows(1).Caption returns "A4 TIMETABLE".
If I am in the other document and I run this macro ..
Sub ActWindow()
Windows("A4 TIMETABLE").Activate
End SUb
The WIndow with document "A4 TIMETABLE" becomes the active (top) window.
What do you get?
Enjoy,
Tony
-------------------------------------------------------------------------------------------- We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at [url=http://www.vbaexpress.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.