ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to prevent multi-access for XLAs? (https://www.excelbanter.com/excel-programming/362002-how-prevent-multi-access-xlas.html)

Stefano Gatto

How to prevent multi-access for XLAs?
 
When Excel opens a workbook, it checks whether it is currently already open,
and in this case opens the workbook in read-only mode. This is good as it
prevents writing conflicts.

However I noticed that Excel won't check that lock, when the file is an
Addin. This is understandable since an Addin is supposed to Add functionality
to Excel, not store data, so that there is no need to handle concurrent
access.

However the Addin I made stores user data and I would like to have Excel to
warn the user that the Addin is in use, whenever someone else has opened it.

Is there a way to have that same warning Excel issues for workbooks, when an
addin is opened by a second user?
--
Stefano Gatto

Peter T

How to prevent multi-access for XLAs?
 
bReadOnly = Thisworkbook.ReadOnly

Note, if all previously opened instances containing the xla get closed, this
last one will remain .ReadOnly = true.

Regards,
Peter T

"Stefano Gatto" wrote in message
...
When Excel opens a workbook, it checks whether it is currently already

open,
and in this case opens the workbook in read-only mode. This is good as it
prevents writing conflicts.

However I noticed that Excel won't check that lock, when the file is an
Addin. This is understandable since an Addin is supposed to Add

functionality
to Excel, not store data, so that there is no need to handle concurrent
access.

However the Addin I made stores user data and I would like to have Excel

to
warn the user that the Addin is in use, whenever someone else has opened

it.

Is there a way to have that same warning Excel issues for workbooks, when

an
addin is opened by a second user?
--
Stefano Gatto





All times are GMT +1. The time now is 12:30 AM.

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