Giorgio-
There's a Password parameter on OpenCurrentDatabase, but I don't think that applies to this password. I did find several examples on the web of how to unlock a Project from code.
http://stackoverflow.com/questions/16174469/unprotect-vbproject-from-vb-code
John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
(Paris, France)
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of giorgio_rovelli
Sent: Wednesday, October 23, 2013 10:17 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] How to open an mdb whose vba code is password protected
What is the code to open, using VBA, an mdb of which you know the password that locks its vba project? (you know, the one that's set in the vba project's properties window)
For example, in the code below, how do you open the strPath database, if you know its vba password, when Protection = 1?
Sub ProcessDatabase(ByVal strPath As String)
Dim vbc As VBIDE.VBComponent
app.OpenCurrentDatabase strPath
With app.VBE.ActiveVBProject
If .Protection = 0 Then
For Each vbc In .VBComponents
ProcessModule vbc.CodeModule, strPath
Next vbc
End If
app.CloseCurrentDatabase
End Sub
Giorgio
Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (2) |
Tidak ada komentar:
Posting Komentar