Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default How do I make an open workbook the active workbook

Looking at the code provided it appears that you want to open if closed or
activate if not the active workbook.

Sub ActivateMyWorkbook() 'from MS
On Error GoTo ErrorHandler
Workbooks("Book2.xls").Activate
'The following line will halt the macro before the error handler
'is reached.
Exit Sub
ErrorHandler:
Workbooks.Open FileName:="Book2.xls"
End Sub

--
Don Guillett
SalesAid Software

wrote in message
...
I have a workbook that is open, and would like to make it the active
workbook. I tried this code, but it does not work. Can anyone tell
me how to do this?

If (Not UtilitiesWorkbookIsOpen("myWorkbook.xls")) Then
MsgBox "Please open myWorkbook.xls"
Exit Sub
Else
ThisWorkbook.Activate
End If



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
When I open a workbook, cell protection is not fully active Dave_B_at C&W Excel Worksheet Functions 0 February 4th 09 10:42 AM
how to open a workbook per active window Jackie[_2_] Excel Discussion (Misc queries) 1 August 19th 08 11:13 PM
Why does a new Excel Workbook open with IV1 as the active cell? pjwing Excel Discussion (Misc queries) 1 July 3rd 07 11:26 PM
copy worksheet from closed workbook to active workbook using vba mango Excel Worksheet Functions 6 December 9th 04 07:55 AM
Preventing opening workbook inside active workbook. Serge[_4_] Excel Programming 2 November 4th 03 07:51 PM


All times are GMT +1. The time now is 06:10 PM.

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"