Make MDE File
acCmdMakeMDEFile
This example is from Microsoft Technet Question PSS ID Number: Q202039. Although the article talks about Access 2000, I have got it to work in Access 97.
This can only be used to make an MDE for another file not the file that the code is being run from.
'***************** Code Start *******************
' Code from Microsoft Technet
Function GenerateMDEFile(MyPath As String)
Dim NAcc As Access.Application
Set NAcc = CreateObject("Access.Application")
'The following lines simulate accepting the default
'name, clicking Make MDE, and clicking Save
SendKeys MyPath & "{Enter}{Enter}"
SendKeys "{Enter}"
NAcc.DoCmd.RunCommand acCmdMakeMDEFile
Set NAcc = Nothing
End Function
'****************** Code End ********************