VBA protection

  • Thread starter javiernews via AccessMonster.com
  • Start date
J

javiernews via AccessMonster.com

Hi,

There is any way to know is a external DB has code password protection ?
I'm using the following code but is Not working:

Sub PassVBA()
' Reference: Microsoft Visual basic for Aplications Extensibility 5.3
Dim oAcc As Object
Dim oAPP As Object
Dim MyDB As String


MyDB = Application.CurrentProject.Path & "\MySamples\" & "PassordVBA.
mdb"
Set oAPP = CreateObject("Access.Application")
Set oAcc = oAPP.DBEngine.OpenDatabase(MyDB, True, False)


If oAcc.VBE.ActiveVBProject.Protection = vbext_pp_locked Then
MsgBox "With password", vbExclamation
Else
MsgBox "WithOut password", vbInformation
End If


End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top