none
Listing MsAccess Macro Steps RRS feed

  • Question

  • I'm trying to write a powershell script to document a database.  I've got a good bit done but I've ran into a sticking point around getting macro steps.  I can output the macro names but not the steps. 

    $Acc = New-Object –com Access.Application
    $Acc.OpenCurrentDataBase("C:\temp\test.accdb")
    
    Foreach ($x in $acc.Application.CurrentProject.AllMacros)
    {
        $x.name
     $acc.Application.SaveAsText($acc,"acMacro",$x.name,"c:\temp\test.txt")
    
    }
    $acc.CloseCurrentDatabase()
    
    

    The code just hangs and locks up ice. Access does open. 

    • Moved by jrv Tuesday, February 20, 2018 4:59 PM Best forum
    Tuesday, February 20, 2018 4:45 PM

All replies

  • acMacro is not a string but an AcObjectType with a value of 4.

    -Tom. Microsoft Access MVP

    Tuesday, February 20, 2018 7:07 PM
  • Hi nashken,

    Could you resolve your issue from the suggestion of Tom?

    You may consider trying code below:

    $acc.Application.SaveAsText($acc, acMacro ,$x.name,"c:\temp\test.txt")

    Best Regards,

    Tao Zhou


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, February 22, 2018 6:35 AM