+ Reply to Thread
Results 1 to 4 of 4

existing file excel2000 macro

  1. #1
    רוזנט
    Guest

    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. #2
    Patrick Molloy
    Guest

    RE: 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. #3
    רוזנט
    Guest

    RE: 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. #4
    Dave Peterson
    Guest

    Re: 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1