![]() |
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. |
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. |
All times are GMT +1. The time now is 02:17 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com