Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Jim Cottrell
 
Posts: n/a
Default activate workbook w/unknown name

Can I activate an open workbook without knowing name?

I have a macro that unprotects a workbook, copys and moves a worksheet,
activates the main workbook to re-protect it but I want to leave the user in
the new workbook. I dont know if the name is Book2 or Book3, etc

Sheets("Grid (2)").Move
ThisWorkbook.Activate
Sheets("Cover").Select
Range("C11").Select
ActiveWorkbook.Protect (["password"])
Now I want to activate the single sheet workbook that I moved (Book2 or Book3)

  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

When you are in the new workbook, set a workbook object to it

Set oWB = ActiveWorkbook

You can always come back to it using that object variable

--
HTH

Bob Phillips

"Jim Cottrell" wrote in message
...
Can I activate an open workbook without knowing name?

I have a macro that unprotects a workbook, copys and moves a worksheet,
activates the main workbook to re-protect it but I want to leave the user

in
the new workbook. I don't know if the name is Book2 or Book3, etc

Sheets("Grid (2)").Move
ThisWorkbook.Activate
Sheets("Cover").Select
Range("C11").Select
ActiveWorkbook.Protect (["password"])
Now I want to activate the single sheet workbook that I moved (Book2 or

Book3)



  #3   Report Post  
Dave Peterson
 
Posts: n/a
Default

I like to use a range object and use that:

Dim CurRng as range

set currng = selection
'do lots of stuff
'now go back
application.goto currng



Jim Cottrell wrote:

Can I activate an open workbook without knowing name?

I have a macro that unprotects a workbook, copys and moves a worksheet,
activates the main workbook to re-protect it but I want to leave the user in
the new workbook. I dont know if the name is Book2 or Book3, etc

Sheets("Grid (2)").Move
ThisWorkbook.Activate
Sheets("Cover").Select
Range("C11").Select
ActiveWorkbook.Protect (["password"])
Now I want to activate the single sheet workbook that I moved (Book2 or Book3)


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
HOW DO I SUM TWO CELLS FROM ONE WORKBOOK TO ANOTHER WORKBOOK? Bill O'Neal Excel Worksheet Functions 8 August 14th 09 11:36 PM
Linking a cell to another workbook cell based on a variable name Brian Excel Discussion (Misc queries) 6 June 1st 05 11:54 PM
Activate a workbook from a selection GregR Excel Discussion (Misc queries) 1 April 7th 05 03:25 AM
Unprotect Workbook Kent Excel Discussion (Misc queries) 1 February 4th 05 01:07 AM
Stubborn toolbars in Excel 007 Excel Discussion (Misc queries) 9 December 11th 04 02:02 PM


All times are GMT +1. The time now is 05:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"