I want to create an MS Access file .mdb
by Excel VBA. I want to set a password for this Access file by Excel VBA.
This below code can create Access file but without password.
Sub Example1()
'the path to create the new access database
Dim strPath As String
'an Access object
Dim objAccess As Object
strPath = "D:\VBA\NewDB2.mdb"
Set objAccess = CreateObject("Access.Application")
Call objAccess.NewCurrentDatabase(strPath)
objAccess.Quit
End Sub
How do I set a password?