Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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/ |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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/ |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Can you elaborate more, because I am confused.
Thanks -- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Error Handling - Check a file isn't already open before overwritin | Excel Discussion (Misc queries) | |||
How to check for Open File! | Excel Discussion (Misc queries) | |||
check if file is already open | Excel Discussion (Misc queries) | |||
check if a file exists / is open | Excel Programming | |||
Check calculation status | Excel Programming |