Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

.Net Interop.Dynamics Macro2 class development/Documentation

(0) ShareShare
ReportReport
Posted on by 7

Hi,

I am looking for any documentation or sample code to use Dynamics Macro2 class using the Interop.Dynamics DLL in Visual Studio C# winforms application.

There are StartPlay/StopPlay/StartRecord/StopRecord methods in the Macro2 class. When trying to StartPlay.StartRecord/StopRecord a macro file, nothing happens (See project steps below). Thanks for any help in advance.

MacroMethods.png

The steps in the project are below with sample code.. 

1. Add Interop.Dynamics.DLL to the project reference

2. Created form with 2 buttons to start record macro and stop record macro

3. In form code to declare class

    public Dynamics.Macro2 GPMacro2 = null;
    public Dynamics.Application GPApp = null;

4. Add code to create instance (Note: Dynamics is already running)

if (GPApp == null)
{
GPApp = (Dynamics.Application)Activator.CreateInstance(Type.GetTypeFromProgID("Dynamics.Application"));
GPMacro2 = (Dynamics.Macro2)Activator.CreateInstance(Type.GetTypeFromProgID("Dynamics.Macro2"));
}

GPApp.CurrentProductID = 0;
GPApp.Activate();

int i = GPMacro2.StartPlay(@"C:\_Macros\t.mac", 0);

Thanks in advance,

Tak

*This post is locked for comments

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,489 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans