Detect if Reference Workbook is Open

Roderick_E

Well-known Member
Joined
Oct 13, 2007
Messages
2,051
I've seen VBA solutions to detect if a reference workbook is open, but is there a formulaic solution without using a UDF?
Thanks
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
You might be able to use something like this:

If a workbook is linked...AND...is currently open
the linking formula has this structure:
Code:
D2: ='[FileName.xlsx]Sheet1'!A1

BUT...if the file is NOT open
the linking formula has this structure:
Code:
D2: ='C:\FolderName\[FileName.xlsx]Sheet1'!A1

So, you might be able to use the FORMULATEXT function to return the formula in the cell and maybe search for a specific pattern:

Code:
E2: =IF(ISERR(SEARCH(":\",FORMULATEXT(D2))),"Open","Closed")
Note: The search term is COLON BACKSLASH....The website may corrupt that.

Is that something you can work with?
 
Upvote 0
You might be able to use something like this:

If a workbook is linked...AND...is currently open
the linking formula has this structure:
Code:
D2: ='[FileName.xlsx]Sheet1'!A1

BUT...if the file is NOT open
the linking formula has this structure:
Code:
D2: ='C:\FolderName\[FileName.xlsx]Sheet1'!A1

So, you might be able to use the FORMULATEXT function to return the formula in the cell and maybe search for a specific pattern:

Code:
E2: =IF(ISERR(SEARCH(":\",FORMULATEXT(D2))),"Open","Closed")
Note: The search term is COLON BACKSLASH....The website may corrupt that.

Is that something you can work with?

Going to test this and will report back thanks
 
Upvote 0
You might be able to use something like this:

If a workbook is linked...AND...is currently open
the linking formula has this structure:
Code:
D2: ='[FileName.xlsx]Sheet1'!A1

BUT...if the file is NOT open
the linking formula has this structure:
Code:
D2: ='C:\FolderName\[FileName.xlsx]Sheet1'!A1

So, you might be able to use the FORMULATEXT function to return the formula in the cell and maybe search for a specific pattern:

Code:
E2: =IF(ISERR(SEARCH(":\",FORMULATEXT(D2))),"Open","Closed")
Note: The search term is COLON BACKSLASH....The website may corrupt that.

Is that something you can work with?

Ok I can work with this thanks. Testing shows that I can't simply put the link into the Formulatext part, I have to reference another cell, but it will still work.
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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