ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Programmatically remove sharing? (https://www.excelbanter.com/excel-programming/301421-re-programmatically-remove-sharing.html)

Anson[_2_]

Programmatically remove sharing?
 
I suppose you can use "Application.Username" to indentify who is working on the file and write the macro according to your specific security needs.

"MDW" wrote:

Hey all,

I've got some VBA code that loops through a folder of Excel files and compiles their data into one sheet. When we give the books to the users, the sheets are protected to help control their data input. As I run my code, I use the .Unprotect method of the worksheet to go through and remove the protection so I can manipulate their stuff.

However, one of my users has shared his workbook, and for some reason this screws up the .Unprotect method. It throws an error - "Unprotect method of Class 'Worksheet' failed."

I know that I can go in and manually remove the sharing from the sheet. However, is there some way I can detect this in the future, and remove the sharing if needed? I tried Workbook.UnprotectSharing and that didn't seem to do anything.

TIA



All times are GMT +1. The time now is 09:02 AM.

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