Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Opening a workbook if not opened, going to it if already opened


Your code works great...just one problem.
When the workbook file is already open, the code makes the workboo
re-open(thus asking me if I want to save changes).
How can I change the code so that if its already open, it just leave
it on(without closing and then re-opening).


Thank

--
neotoky
-----------------------------------------------------------------------
neotokyo's Profile: http://www.excelforum.com/member.php...fo&userid=1389
View this thread: http://www.excelforum.com/showthread.php?threadid=26327

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Opening a workbook if not opened, going to it if already opened

No, my code doesn't do that.

Apparently you have screwed it up.

My code is tested and works fine:

Sub BBB()
Dim wkbk As Workbook
On Error Resume Next
Set wkbk = Workbooks("ABC.xls")
On Error GoTo 0
If wkbk Is Nothing Then
Set wkbk = Workbooks.Open("C:\Myfiles\ABC.xls")
End If
wkbk.Activate
End Sub


did you change the name from ABC.xls and C:\MyFiles\ABC.xls to the name/path
and name of your workbook - perhaps you have misspelled the name.

--
Regards,
Tom Ogilvy

"neotokyo" wrote in message
...

Your code works great...just one problem.
When the workbook file is already open, the code makes the workbook
re-open(thus asking me if I want to save changes).
How can I change the code so that if its already open, it just leaves
it on(without closing and then re-opening).


Thanks


--
neotokyo
------------------------------------------------------------------------
neotokyo's Profile:

http://www.excelforum.com/member.php...o&userid=13892
View this thread: http://www.excelforum.com/showthread...hreadid=263271



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
Is there away to keep Excel from opening a copy of an already opened workbook and the pages not be at 100% but Marc New Users to Excel 1 March 13th 06 01:51 PM
Opening a workbook if not opened, going to it if already opened neotokyo Excel Programming 1 September 24th 04 06:33 PM
How to see if the opened workbook is opened by another user ? balexis Excel Programming 1 August 18th 04 04:11 PM
Sheets select method fails when workbook is opened by another workbook Mike Excel Programming 2 June 8th 04 04:17 AM
opening diff. worksheets in opened workbook AlexD Excel Programming 3 April 22nd 04 08:23 PM


All times are GMT +1. The time now is 06:29 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"