Announcements
No record found.
Hi, I'm trying to launch a gp macro from a new button on a GP window. I've added the button but not sure of the syntax to launch the macro in VB Editor. Has anyone done this?
*This post is locked for comments
Please take a look at this thread. I think it is exactly what you need.
https://community.dynamics.com/gp/f/32/t/39242
Mariano Gomez posted this:
Add the following code to your VBA event:Dim CompilerApp As ObjectDim CompilerMessage As StringDim CompilerError As IntegerDim Commands As StringDim MacroPath as String' Create object without having reference markedSet CompilerApp = CreateObject("Dynamics.Application")MacroPath = "C:\SomeDirectory\SomeMacro.mac"Commands = "run macro "" & MacroPath & "";"' Execute SanScriptCompilerError = CompilerApp.ExecuteSanscript(Commands, CompilerMessage)If CompilerError <> 0 ThenMsgBox CompilerMessageEnd IfBest regards,
Leslie
That's exactly what I needed! Thanks Leslie.
Hello Leslie,
I am experiencing an issue when using this VBA code to open a macro. I see error message "cannot open macro file". I am an administrator on our GP server and have tried multiple locations to place the macro file. The macro runs successfully when I choose Tools-->Macro-->Play. Any ideas on if there is a file network security piece to this?
Thank you,
Justin K
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.
Congratulations to our 2026 Super Stars!
We are thrilled to have these Champions in our Community!
These are the community rock stars!
Stay up to date on forum activity by subscribing.