I have a .mac that clicks two buttons on a window. This window was created by a consultant who is long gone so I don't have access to their code to see exactly what these buttons are doing. However, I do know that they are doing what they are supposed to do, I just can't recreate their processes very easily, if at all. The window is evidently restricted, because when I bring it into Dexterity, nothing is available to edit.
So, my solution was to write the .mac to click the two buttons. Plus, I've written vba code to do all the logic testing and looping that I need, but now I need to execute the .mac. After a lot of research and pain, I find out that doing this is not something vba can do very easily. I've tried the following two methods:
1. Sendkeys. F12 is the GP shortcut for the macro:
For Each i In EX_TC_Array
TimeCode = i
SendKeys "{F12}", True
Next I
2. SanScript "Run Macro"
For Each i In EX_TC_Array
TimeCode = i
Set CompilerApp = CreateObject("Dynamics.Application")
MacroPath = "C:\Program Files (x86)\Microsoft Dynamics\GP2015\Macros\ATT_Looper.mac"
Commands = "run macro "" & MacroPath & "";"
' Execute SanScript
CompilerError = CompilerApp.ExecuteSanscript(Commands, CompilerMessage)
If CompilerError <> 0 Then
MsgBox CompilerMessage
End If
Next i
Neither of these seem to be doing anything. Running the F12 straight out of GP, the shortcut works, but in vba, it hits and processes these steps without error, but nothing happens. I even moved the "SendKeys" logic to be the last step in my vba code thinking it was a processing timing issue, but it still did nothing. Am I missing a setting within GP that would allow this kind of control? Is there something wrong with my use of any of the code? Or is there a better way (keeping in mind I can't use dexterity for this)?