Results 1 to 4 of 4

Thread: If Not Open, Open File - VBA

  1. #1
    New Member
    Join Date
    Dec 2017
    Posts
    43
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default If Not Open, Open File - VBA

    Hi All

    I am after a check/open file VBA. I can create a macro to open/close a file (cheers Guys who helped ), now would like to add a check too.
    If FILE A is open, continue, if NOT open FILE A... type of thing.

    Thank you all!

  2. #2
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    28,353
    Post Thanks / Like
    Mentioned
    471 Post(s)
    Tagged
    47 Thread(s)

    Default Re: If Not Open, Open File - VBA

    Something like
    Code:
       Dim Wbk As Workbook
       
       On Error Resume Next
          Set Wbk = Workbooks("Book1.xlsm")
       On Error GoTo 0
       If Wbk Is Nothing Then
          set wbk=workbooks.Open(..)
       End If
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

  3. #3
    New Member
    Join Date
    Dec 2017
    Posts
    43
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: If Not Open, Open File - VBA

    Thank you, sorry I have not tried it yet due to work load.

  4. #4
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    28,353
    Post Thanks / Like
    Mentioned
    471 Post(s)
    Tagged
    47 Thread(s)

    Default Re: If Not Open, Open File - VBA

    That's ok.
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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