Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default 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/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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/



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Check file open status

Can you elaborate more, because I am confused.

Thanks

--
Message posted from http://www.ExcelForum.com

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
Error Handling - Check a file isn't already open before overwritin NDBC Excel Discussion (Misc queries) 4 August 13th 09 08:36 AM
How to check for Open File! Ayo Excel Discussion (Misc queries) 2 August 11th 08 06:55 PM
check if file is already open mohavv Excel Discussion (Misc queries) 1 October 15th 07 12:08 AM
check if a file exists / is open Mark Kubicki Excel Programming 1 December 4th 03 05:56 PM
Check calculation status Jeff Excel Programming 2 November 25th 03 04:23 PM


All times are GMT +1. The time now is 09:55 PM.

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"