Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Opened Workbook

I intend to work on an opened workbook using Macro in another workbook. The
code I use is:

Dim wk as Workbook
Set wk=Workbooks.open("c:\a.xls")

It works when a.xls is closed. But when it is opened. I got a messgae "The
workbook is already Opened". Does anyone know how? Thanks.
--
I like Vb.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Opened Workbook

Dim wk as Workbook
On Error Resume Next
set wk = workbooks("a.xls")
On Error goto 0
if wk is nothing then
Set wk=Workbooks.open("c:\a.xls")
End if

msgbox wk.Name ' wk now is a reference to a.xls regardless

--
Regards,
Tom Ogilvy


"Jiao" wrote in message
...
I intend to work on an opened workbook using Macro in another workbook.

The
code I use is:

Dim wk as Workbook
Set wk=Workbooks.open("c:\a.xls")

It works when a.xls is closed. But when it is opened. I got a messgae "The
workbook is already Opened". Does anyone know how? Thanks.
--
I like Vb.



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
Opening a workbook if not opened, going to it if already opened neotokyo[_3_] Excel Programming 0 September 24th 04 08:56 PM
Opening a workbook if not opened, going to it if already opened neotokyo[_2_] Excel Programming 1 September 24th 04 07:17 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


All times are GMT +1. The time now is 11:08 AM.

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

About Us

"It's about Microsoft Excel"