Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Knowing is a workbook's VBA project has password or not

Is there a way to know (using VBA code) if a workbook's VBA project is
password protected?
In other words, I want to be able to know if the workbook's macros are
running on a password protected or un-protected VBA Poject?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Knowing is a workbook's VBA project has password or not

Dim wkbk As Workbook
Set wkbk = Workbooks("yourworkbooknamehere.xls")

If wkbk.VBProject.Protection = vbext_pp_locked Then
MsgBox "it's locked"
Else
MsgBox "It's not"
End If

==========
I _think_ that this was added in xl2k. But you'll want to test it in all the
versions of excel that you're supporting.

OMER wrote:

Is there a way to know (using VBA code) if a workbook's VBA project is
password protected?
In other words, I want to be able to know if the workbook's macros are
running on a password protected or un-protected VBA Poject?


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Knowing is a workbook's VBA project has password or not

Thank You Dave. It worked.
I changed vbext_pp_locked to 1 because the reference to VB extensibility is
not set.


"Dave Peterson" wrote:

Dim wkbk As Workbook
Set wkbk = Workbooks("yourworkbooknamehere.xls")

If wkbk.VBProject.Protection = vbext_pp_locked Then
MsgBox "it's locked"
Else
MsgBox "It's not"
End If

==========
I _think_ that this was added in xl2k. But you'll want to test it in all the
versions of excel that you're supporting.

OMER wrote:

Is there a way to know (using VBA code) if a workbook's VBA project is
password protected?
In other words, I want to be able to know if the workbook's macros are
running on a password protected or un-protected VBA Poject?


--

Dave Peterson
.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA Project Password george m Excel Programming 2 May 30th 07 02:35 PM
Project password Steven Excel Programming 2 January 13th 06 07:23 PM
I need to remove a password on our timesheet without knowing the p Duncan Excel Discussion (Misc queries) 2 June 14th 05 11:54 PM
VBA Project Password Daniel Excel Programming 2 July 15th 04 12:47 AM
Accesing vba project from wb that has vba project password protected cassidyr1 Excel Programming 2 July 3rd 04 01:49 PM


All times are GMT +1. The time now is 08:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"