开发者

Dump MS Access Macro object info from VBA code

I have a project in which I need to compare different versions of an Access 2003 database against each other. We're not interested in the data in the tables. We're only interested in the objects that describe the database. I.e. Form objects, Report objects, QueryDefs, TableDefs 开发者_运维百科etc.. The databases are fairly large so the approach is to dump all the descriptions for objects of interest into a text file by running a VBA app in each of the databases and then comparing the results in a diff viewer.

I've been looking around for several days to find out how to dynamically dump access 2003 macro content from within VBA. Please don't confuse this with dumping VBA code from VBA.

I know about Application.CurrentDB.AllMacros to get a list of macros in the active access database. But I can't get at the macro object from Macro(MacroName).SomeProperty because the macro isn't open. So I've been trying to look for a way to open the macro and haven't found a way to accomplish this through VBA.

Any help on the topic would be appreciated.

Thanks!


You can export macros with the undocument Application.SaveAsText:

  Application.SaveAsText acMacro ,"AutoKeys", "AutoKeys.txt"

...saves the AutoKeys macro to whatever the current directory is.


You could manually ask Access to convert the macros to VBA. There is an option for that, I think when you right click the macro. After that you can compare the generated VBA.


See the following page for a list of utilities to compare Access databases http://www.granite.ab.ca/access/thirdparty.htm

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜