I'm using this code to open a workbook so I can grab some of the builtin properties.
The code works fine until I hit a workbook that someone has open -then I get this error dialog:
If I choose End instead of Debug (or if I Reset the VBE) the target workbook is presented as an open workbook?! (I thought I just asked not to open the workbook!) If I go to the File tab on the ribbon, the Properties shows me as the Last Modified By.
The object of the exercise is to walk a branch of the volume tree to gather statistical information on many dozens of workbooks. I'm using Workbooks.Open because I don't know any other way to get to the builtin document properties (can I get them using ADODB?) . As far as I know I'm doing nothing to modify the workbook in any way (other than the fact that I'm touching it) - so I should be able to open read only, grab my data, close it and move on - even if someone else is editing it at the time.
So - my question is: What am I doing wrong? How can I get data out of a workbook someone else has open? (Without interrupting my macro?)
Nothing I've found so far with Google's assistance has helped. </other>
Code:
Function OpenHidden(ByRef szFullName As String) As Workbook
<other code="" here="">... other code here ...
Set OpenHidden = Workbooks.Open(szFullName, UpdateLinks:=False, _
ReadOnly:=True, Notify:=True)
End Function
When I choose No I get the debugger dialog, which in turn breakpoints on the Workbooks.Open line above....xlsx is already open. Reopening will cause any changes you made to be discarded. Do you want to reopen ...xlsx?
If I choose End instead of Debug (or if I Reset the VBE) the target workbook is presented as an open workbook?! (I thought I just asked not to open the workbook!) If I go to the File tab on the ribbon, the Properties shows me as the Last Modified By.
The object of the exercise is to walk a branch of the volume tree to gather statistical information on many dozens of workbooks. I'm using Workbooks.Open because I don't know any other way to get to the builtin document properties (can I get them using ADODB?) . As far as I know I'm doing nothing to modify the workbook in any way (other than the fact that I'm touching it) - so I should be able to open read only, grab my data, close it and move on - even if someone else is editing it at the time.
So - my question is: What am I doing wrong? How can I get data out of a workbook someone else has open? (Without interrupting my macro?)
Nothing I've found so far with Google's assistance has helped. </other>