Dim db
Dim strDbName
dim strPassword
dim strMacro
strMacro = "** Run Spending Plan Database"
strdbName = "
\\msp0ms01\pine bend project controls\Reporting\Databases\Spending Plan DB\Project_Portfolio_Reporting.accdb"
strPassword = ""
Set acc = createobject("Access.Application")
' this temporarily changes the macros security to low to avoid messages.
'onlt works with access 2000 onwards
if acc.syscmd(7) >= 10 Then
acc.AutomationSecurity = 1
End if
'if you do not need to see Access delete this line
acc.Visible = True
Set db = acc.DBEngine.OpenDatabase(strDbName, False, False, ";PWD=" & strPassword)
acc.OpenCurrentDatabase strDbName
acc.docmd.runmacro strMacro
db.Close