如何将Access数据库保存为ACCDE(来自VBA)?

时间:2014-04-22 22:07:34

标签: vba access-vba ms-access-2010

我正在Access中开发一个应用程序。我想做的是能够编写已部署版本的脚本。

为此,我想:

  • 将宏(m_AutoKey)重命名为AutoKey
  • 编译VBA代码
  • 将功能区(通过文件 - >选项 - >当前数据库 - >功能区名称)更改为"阻止选项" (这是一个自定义的USysRibbon条目)
  • 另存为ACCDE

这就是我目前的情况,这是可怜的,因为我使用sendkeys两次。但是,我能够做到3/4。

Public Sub MakeDeployable()

    'how can I do this? All examples seem to use
    'Me.RibbonName which sets it for a form, not globally
    'Application.RibbonName = "Block Options"

    'this works... (from a button)
    Dim i As Integer
    SendKeys "%ft"
    SendKeys "c"

    For i = 1 To 18
    SendKeys "{TAB}"
    Next i

    SendKeys "{DOWN}"
    SendKeys "{UP}"
    SendKeys "{DOWN}"
    SendKeys "{TAB}"

    'this works
    DoCmd.Rename "AutoKeys", acMacro, "m_AutoKeys"



    'force a compile (from a button)
    SendKeys "%{F11}%di"


    'I don't know how to do "SaveAs ACCDE" basically
    Dim sourceDB As String
    Dim targetDB As String
    sourceDB = Application.CurrentDb.Name
    targetDB = Left(sourceDB, InStrRev(sourceDB, "\")) & "myTest.accde"
    'application.ConvertAccessProject sourcedb, targetdb,

End Sub
  • 如何通过VBA将应用程序保存为ACCDE?

0 个答案:

没有答案