Rename Macro in another database

InstructionWhich7142

Registered User.
Local time
Today, 04:03
Joined
Feb 24, 2010
Messages
203
As part of a deployment tool I want to rename autoexec1 to Autoexec to "enable" a database for deployment,

In VBA I've got a "Save and Publish as ACCDE" working and "compact and repair", I just need to rename this macro and I'm sorted,

Code:
Set db2e = OpenDatabase(CurrentProject.Path & "\DB2.accde")
db2e.Rename "autoexec", acMacro, "autoexec1"

except you can't replace DoCmd like that and all the examples online are for tables and use tabledefs
 
you can try:

Code:
Public Sub ControlAccess()
Dim acc As New Access.Application
With acc
    .Application.Visible = True
    .OpenCurrentDatabase "G:\Documents\files\generic.mdb"
     With .Application
          .DoCmd.Rename "NewMacroname", acMacro, "AutoExec"
     End With
    '.Quit
End With
Set acc = Nothing
End Sub
[\code]
 
lovely thank you, that worked a treat, I wondered if a With was the way but I didn't quite apply it to get the docmd working how you described :)
 

Users who are viewing this thread

Back
Top Bottom