Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default IN MACROS HOW TO IGNORE ANY FILE.

Here's one that is shorter and doesn't use Goto.

Function IsWorkbookOpen(WBName As String) As Boolean
On Error Resume Next
IsWorkbookOpen = CBool(Len(Workbooks(WBName).Name))
End Function


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com
(email address is on the web site)


"WhytheQ" wrote in message
oups.com...
similar to Bob's :

Private Function IsFileOpen(strFile As String) As Boolean

Dim aName As String

On Error GoTo NotOpen:
aName = Workbooks(strFile).Name
IsFileOpen = True
GoTo FunctionEnd:
NotOpen:
IsFileOpen = False
FunctionEnd:

End Function

Rgds
J

On Nov 14, 11:48 am, "Bob Phillips" wrote:
Just try opening but handling any errors

On Error Resume Next
Set oWB = Workbooks.Open("C:\MyTest\myFile.xls")
On Error Goto 0
If oWB Is Nothing Then
MsgBox "File doen't exist here"
End If

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"Vijay Kotian" wrote in
...



In Excel Macros, if particiular file specified is not available in the
harddisk or any other source while opening i always get a error message
(debug mode). How is it possible to ignore without debugging the
program
every time?


Pl. Help if any other alternatives are available..


Thanx- Hide quoted text -- Show quoted text -




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
Open dbf file then close. do nothing..ignore any message. musa.biralo Excel Programming 3 September 27th 06 03:26 AM
Remove macros in xls file, but keep macros in xlt file nulad Excel Programming 1 April 7th 06 09:07 AM
Can Excel ignore file links that do not yet exist? DaveyC4S Excel Discussion (Misc queries) 2 February 7th 06 07:34 PM
Ignore file links that do not exist. DaveyC4S Excel Discussion (Misc queries) 1 February 7th 06 03:53 PM
Code to ignore on-screen message concerning "Enable Macros." Phil Hageman[_3_] Excel Programming 2 February 26th 04 01:51 PM


All times are GMT +1. The time now is 08:27 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"