We help IT Professionals succeed at work.
Get Started

How to pass VBE password from a form

Last Modified: 2012-05-07
A have a form which need transfert Form and module import from an another database
The user don't know VBE pwd
I have this code which do it
But sometimes, it don't work good and the user get a msgbox asking password and after get the windows of VBE propriety
Otherwise it work good and the user see nothing
I put the code after
If you have remarks Thanks
Sub Autorise
    Dim proj As Object
    Dim data As String
    If Me.On_error Then On Error GoTo ErreurVB
    Set proj = Application.VBE.activeVBProject
'    DoEvents                                      ' i don't know if useful ?
    data = "xxxxx{TAB}~~"                   ' xxxxx is the password
    Sleep 100
    SendKeys data, True   '  pwd + Tab + 2 return to close propriety windows
    Application.VBE.CommandBars(1).FindControl(msoControlButton, id:=2578, Visible:=True, recursive:=True).Execute
    Exit Sub

Open in new window

Watch Question
MIS Liason
Most Valuable Expert 2012
This problem has been solved!
Unlock 3 Answers and 6 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE