Reverse Engineer Accessing macros from .NET.

An employee inherited a Microsoft Access macro that performs a series of SQL operations on a Sybase database, invoking OpenQuery on a bunch of action queries that use linked tables via ODBC. I would like to help him convert it to an SQL script, which we can execute directly against the database. And since we have many such macros, I would like to come up with a conversion tool.

(If it no longer exists, in which case, please direct me to it.)

I expected to access macro details using COM interop. So far, I have not been able to find a way to get to these details. Here is what I still have.

Imports Access = Microsoft.Office.Interop.Access
Imports System.Runtime.InteropServices

Module Module1

    Sub Main()
        Dim app As New Access.Application()
        app.OpenCurrentDatabase("c:\test.mdb")
        Dim macro As Access.AccessObject = app.CurrentProject.AllMacros("Macro1")
        'Do something with variable "macro"???'
        app.Quit(Access.AcQuitOption.acQuitSaveNone)
        Marshal.FinalReleaseComObject(app)
    End Sub

End Module

, AccessObject . , . - - - ? - DoCmd SysCmd, ?

(, , SQL, Sybase SQL. , .)

+3
1

, - :

application.saveastext acMacro, "Macro1", "Macro1.txt"

Action Argument.

+4

Source: https://habr.com/ru/post/1748904/


All Articles