Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default existing file excel2000 macro

if i want to check if a file is not open the macro is
If Workbooks("Ttt.xls") Is Nothing Then.....


but when i want to write it in the opposit
like: If Workbooks("Ttt.xls") Is exist Then.....
this macro did not work
what is the correct macro to the opposit of " Is Nothing"

thank you
rozent
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default existing file excel2000 macro

If NOT Workbooks("Ttt.xls") Is Nothing Then

"רוז×*ט" wrote:

if i want to check if a file is not open the macro is
If Workbooks("Ttt.xls") Is Nothing Then.....


but when i want to write it in the opposit
like: If Workbooks("Ttt.xls") Is exist Then.....
this macro did not work
what is the correct macro to the opposit of " Is Nothing"

thank you
rozent

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default existing file excel2000 macro


hi patrick
i tried but i get the same msg either the file is open or not

Sub AAA()
On Error Resume Next
If Not Workbooks("filename.xls") Is Nothing Then
MsgBox "the file is open"
Exit Sub
Else
MsgBox "the file is not open"
End If

End Sub



"Patrick Molloy" wrote:

If NOT Workbooks("Ttt.xls") Is Nothing Then

"רוז×*ט" wrote:

if i want to check if a file is not open the macro is
If Workbooks("Ttt.xls") Is Nothing Then.....


but when i want to write it in the opposit
like: If Workbooks("Ttt.xls") Is exist Then.....
this macro did not work
what is the correct macro to the opposit of " Is Nothing"

thank you
rozent

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default existing file excel2000 macro

You could just put what you want in the appropriate Then/Else portion of your
code.

Option Explicit
Sub testme()

Dim myWkbk As Workbook

Set myWkbk = Nothing
On Error Resume Next
Set myWkbk = Workbooks("TTT.xls")
On Error GoTo 0

If myWkbk Is Nothing Then
'do something
Else
'do something else
End If

End Sub

????? wrote:

if i want to check if a file is not open the macro is
If Workbooks("Ttt.xls") Is Nothing Then.....

but when i want to write it in the opposit
like: If Workbooks("Ttt.xls") Is exist Then.....
this macro did not work
what is the correct macro to the opposit of " Is Nothing"

thank you
rozent


--

Dave Peterson
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
Opening .csv file in Excel2003 vs Excel2000 Holmark Excel Discussion (Misc queries) 9 April 24th 07 07:43 PM
copy multiple worksheets of a workbook, and paste onto a Word document ( either create new doc file or paste onto an existing file.) I need this done by VBA, Excel Macro Steven Excel Programming 1 October 17th 05 08:56 AM
Creating a new excel file from an existing file using macro Macro Excel Programming 2 July 28th 05 06:40 PM
SaveAs macro: How do I specify "Replace existing file?" [email protected] Excel Programming 1 May 24th 05 02:36 AM
Import xls file..vba excel2000 Soli3d Excel Programming 3 February 1st 05 06:14 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"