Results 1 to 6 of 6

How can I unprotect VBProject in workbook by VB Code?

This is a discussion on How can I unprotect VBProject in workbook by VB Code? within the Excel Questions forums, part of the Question Forums category; Hi all, How can I code for unprotect and protect VBProject in my workbook by VB code? There is password ...

  1. #1
    New Member
    Join Date
    May 2003
    Posts
    24

    Default How can I unprotect VBProject in workbook by VB Code?

    Hi all,
    How can I code for unprotect and protect VBProject in my workbook by VB code? There is password also.

    Thanks in advance,
    Kreang

  2. #2
    MrExcel MVP
    Join Date
    May 2003
    Location
    USA
    Posts
    3,692

    Default Re: How can I unprotect VBProject in workbook by VB Code?

    Kreang -

    VBA does not expose VBProject passwords in its object model. The way password crackers do it is by trial end error using something like SendKeys or various Windows APIs to send trial passwords to the appropriate dialog box.

    - Jon
    -------
    Jon Peltier, Microsoft Excel MVP
    http://www.geocities.com/jonpeltier/Excel/index.html
    _______

  3. #3
    MrExcel MVP Ivan F Moala's Avatar
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    4,209

    Default Re: How can I unprotect VBProject in workbook by VB Code?

    Quote Originally Posted by Kreang
    Hi all,
    How can I code for unprotect and protect VBProject in my workbook by VB code? There is password also.

    Thanks in advance,
    Kreang
    If it's your Project and you know the password then one option
    look here

    http://216.92.17.166/board2/viewtopi...sswword#104204
    Kind Regards,
    Ivan F Moala From the City of Sails

  4. #4
    New Member
    Join Date
    May 2003
    Posts
    24

    Default Re: How can I unprotect VBProject in workbook by VB Code?

    Hi,
    I try as below

    Set wbbproj = ThisWorkbook.VBProject
    wbbproj.VBE.selectedvbcomponent.Select
    Application.SendKeys "test", True
    Application.SendKeys "~", True

    but it can not use. (I use MS Excel2000)

    Remarks : "test" is my password
    I think, problem is line#2, How can I do the "VBProject Password window" show?
    I think, if we can do the "VBAProject Password" window show, we can use sendkeys to enter password.

    Thanks in advance,
    Kreang

  5. #5
    New Member
    Join Date
    Mar 2003
    Posts
    26

    Default Re: How can I unprotect VBProject in workbook by VB Code?

    This will unprotect a sheet. Replace "mypassword" with whatever your password is.
    Code:
    ActiveSheet.Unprotect Password:="mypassword"
    This will password protect a sheet. Replace :mypassword" with whatever your password is.
    Code:
    ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, Password:="mypassword"
    Is this what you were asking for ?

    Cheers
    clarence

  6. #6
    New Member
    Join Date
    May 2003
    Posts
    24

    Default Re: How can I unprotect VBProject in workbook by VB Code?

    Hi Clarence,
    I don't want to protect or unprotect worksheet ,I want to unprotect VBProject by VB code.

    Thanks,
    Kreang

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


DMCA.com