Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / July 2007

Tip: Looking for answers? Try searching our database.

Identifying current window

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Don - 27 Jul 2007 15:51 GMT
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.
Dave Peterson - 27 Jul 2007 16:13 GMT
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.

> 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?
[quoted text clipped - 6 lines]
> 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.

Signature

Dave Peterson

Don - 27 Jul 2007 18:04 GMT
Thank you.

> Instead of going through the windows collection, you could do:
>
[quoted text clipped - 19 lines]
>> macros
>> and than make small changes to fine tune them to my needs.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.