TangentialAccel
New Member
- Joined
- Jan 22, 2018
- Messages
- 7
Hi guys,
<o></o>
I’m trying to write VB code in workbook A that monitors the next workbook to open (we’ll call it workbook B) and reports back to workbook A whether or not Workbook B is read-only or not. Workbook B could be a VBA enabled or a non-VBA enabled workbook and could be any workbook opened by the user, so the file path and file name wouldn’t be known. I would like Workbook A to report a Boolean value – True if workbook B is read-only, and False if workbook B is not read-only. Below is what Ihave so far, but I know that I’m missing something... I'm using Excel 2007 btw.
<o></o>
Thanks in advance!<o></o>
<o></o>
I’m trying to write VB code in workbook A that monitors the next workbook to open (we’ll call it workbook B) and reports back to workbook A whether or not Workbook B is read-only or not. Workbook B could be a VBA enabled or a non-VBA enabled workbook and could be any workbook opened by the user, so the file path and file name wouldn’t be known. I would like Workbook A to report a Boolean value – True if workbook B is read-only, and False if workbook B is not read-only. Below is what Ihave so far, but I know that I’m missing something... I'm using Excel 2007 btw.
<o></o>
Code:
'Code in ThisWorkbook object in Workbook A:
Public ro As Boolean
Private Sub workbook_activate()
If ActiveWorkbook.ReadOnlyRecommended = True Then
MsgBox "This workbook is saved as read-only recommended"
ro = True
Else
ro = False
End If
End Sub