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 / Programming / November 2007

Tip: Looking for answers? Try searching our database.

how to set workbook window active

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Daniel M - 26 Nov 2007 04:21 GMT
I have an add in that i have installed with all my macros in it. In one of my
macros i call it to open another workbook for a vlookup. i then want to
continue with the previous workbook but i dont know how to return the focus
to that workbook.

add in: macros.xla
file opened: opened.xls (name is variable!)
call to open: master list.xls

I cant do Thisworkbook.active because i am running out of the add-in.
i cant do windows(opened.xls).active because i wont know the file name.

What can i do? Thanks.
carlo - 26 Nov 2007 04:34 GMT
On Nov 26, 1:21 pm, Daniel M <Dani...@discussions.microsoft.com>
wrote:
> I have an add in that i have installed with all my macros in it. In one of my
> macros i call it to open another workbook for a vlookup. i then want to
[quoted text clipped - 9 lines]
>
> What can i do? Thanks.

you could store the recent workbook before opening the opened.xls
and then restore it again:
'----------------------------------------------------------
dim Curr_WB as workbook

set Curr_WB = activeworkbook

'openworkbook
'do your thing

Curr_WB.activate
'----------------------------------------------------------
hth

Carlo
 
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.