Test for VBAProject Locked from Viewing
Is it possible to test from within my Excel program
as to whether the overall VBAProject is Locked from Viewing? (I would like to branch one way within the program for knowledgable, trustworthy users who have the unlocked version, but another way for regular users for whom the code is locked from viewing.) -- Dennis Eisen |
Test for VBAProject Locked from Viewing
Dennis,
Try something like the following: If ThisWorkbook.VBProject.Protection = 0 Then Debug.Print "Not locked" Else Debug.Print "Locked" End If -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "DennisE" wrote in message ... Is it possible to test from within my Excel program as to whether the overall VBAProject is Locked from Viewing? (I would like to branch one way within the program for knowledgable, trustworthy users who have the unlocked version, but another way for regular users for whom the code is locked from viewing.) -- Dennis Eisen |
Test for VBAProject Locked from Viewing
Chip,
Thanks so much for your help; my final version took the form If ThisWorkbook.VBProject.Protection _ = vbext_pp_locked Then [do this code for simpletons] Else [do this code for the cognesenti] End If (This requires early binding with vbe6ext.olb, but my program required it anyway.) -- Dennis Eisen |
All times are GMT +1. The time now is 09:16 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com