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
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
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
That's exactly what I needed! Thanks Leslie.
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 Object
Dim CompilerMessage As String
Dim CompilerError As Integer
Dim Commands As String
Dim MacroPath as String
' Create object without having reference marked
Set CompilerApp = CreateObject("Dynamics.Application")
MacroPath = "C:\SomeDirectory\SomeMacro.mac"
Commands = "run macro "" & MacroPath & "";"
' Execute SanScript
CompilerError = CompilerApp.ExecuteSanscript(Commands, CompilerMessage)
If CompilerError <> 0 Then
MsgBox CompilerMessage
End If
Best regards,
Leslie
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,280 Super User 2024 Season 2
Martin Dráb 230,214 Most Valuable Professional
nmaenpaa 101,156