开发者

Excel VBA Only Allow Administrator to Modify Workbook

I am having some issues with VBA to allow only Administrato开发者_JAVA技巧rs to modify an excel workbook. Can anyone help me with the code to make this happen? Thanks!


Getting the username is fairly straightfoward:

 username = Environ("UserName")

It is also possible through API calls, which is detailed here

You can then check that username against your list of administrators. If they are in the list, you can then unprotect the workbook.

 ThisWorkbook.Unprotect 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜