![]() |
Check file open status
Hi all,
I have written a macro to do cell copying from a xls to another xls, i the marco I used .getopenfilename to open a file, but I do not want t open the file again if it is already opened. So how can I check th file open status? Thanks -- Message posted from http://www.ExcelForum.com |
Check file open status
On Error Resume Next
Set wb = Workbooks("MyWorkbook.xls") On Error GoTo 0 If wb Is Nothing Then 'open it Else 'already open End If -- Vasant "kaon " wrote in message ... Hi all, I have written a macro to do cell copying from a xls to another xls, in the marco I used .getopenfilename to open a file, but I do not want to open the file again if it is already opened. So how can I check the file open status? Thanks. --- Message posted from http://www.ExcelForum.com/ |
Check file open status
Thanks.
Now what I concern now is the error statement. I have previousl declared one already, how can I resume the error statement afte executing the piece of code above? Code I wrote: On Error GoTo EOS Set abcWks = ThisWorkbook.ActiveSheet fName = Application.GetOpenFilename(FileFilter:="All files (*.*) *.*", _ Title:="Select a file" MultiSelect:=False) If fName = "False" Then Exit Sub Else: Set xyzWkbk = Workbooks.Open(Filename:=fName) End I -- Message posted from http://www.ExcelForum.com |
Check file open status
Use the error statements shown.
-- Regards, Tom Ogilvy "kaon " wrote in message ... Thanks. Now what I concern now is the error statement. I have previously declared one already, how can I resume the error statement after executing the piece of code above? Code I wrote: On Error GoTo EOS Set abcWks = ThisWorkbook.ActiveSheet fName = Application.GetOpenFilename(FileFilter:="All files (*.*), *.*", _ Title:="Select a file", MultiSelect:=False) If fName = "False" Then Exit Sub Else: Set xyzWkbk = Workbooks.Open(Filename:=fName) End If --- Message posted from http://www.ExcelForum.com/ |
Check file open status
Can you elaborate more, because I am confused.
Thanks -- Message posted from http://www.ExcelForum.com |
All times are GMT +1. The time now is 03:08 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com