ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Opened File (https://www.excelbanter.com/excel-programming/271375-re-opened-file.html)

Rob Bovey

Opened File
 
"Combo" wrote in message
...
Are there a function in VBA programming has return if a file of excel

if
already opeded by other user in my intranet?


The only way I know of is to just open the workbook and check to see if
VBA has opened as read-only. If so it means the workbook is already opened
by another user. For example:

Dim wkb As Workbook
Set wkb = Workbooks.Open("E:\Book1.xls", , , , , , True)
If wkb.ReadOnly Then
MsgBox wkb.Name & " is open by another user."
wkb.Close
End If

Note that the IgnoreReadOnlyRecommended flag has been set to True so you
don't mistake files saved as read-only recommended for files that are open
by another user.

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *




All times are GMT +1. The time now is 05:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com