If Not Open, Open File - VBA

dnorm

Board Regular
Joined
Dec 28, 2017
Messages
125
Office Version
  1. 365
Platform
  1. Windows
Hi All

I am after a check/open file VBA. I can create a macro to open/close a file (cheers Guys who helped (y) ), 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!
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
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
 
Upvote 0
Thank you, sorry I have not tried it yet due to work load.
 
Upvote 0

Forum statistics

Threads
1,214,821
Messages
6,121,759
Members
449,048
Latest member
excelknuckles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top