Re: Re: How to add Sleep command in vba macro for Great Plains
Hi David,
Thank you for your information.
I have imported the SY_Check_Links package into the GP.
I try to the next step which is
Go into the VBA editor (Tools >> Customise >> Visual Basic Editor) and compile the Microsoft Dynamics GP project (Debug >> Compile Microsoft Dynamics GP.
I have got the following error:
Complie error:
Expected: line number or label or statement.
What could be the problem...
The extrated Module is
<Component Name="SY_Check_Links" ProductId="0" Object="VBAForm" >
VBAForm "SY_Check_Links"
{
Windows
{
Window "Check Links"
{
Code "Option Explicit"
Private Sub Window_AfterClose()
'Dim CompilerApp As New Dynamics.Application
Dim CompilerApp As Object
Dim CompilerMessage As String
Dim CompilerError As Integer
Dim Commands As String
' Create link without having reference marked
Set CompilerApp = CreateObject(\"Dynamics.Application\")
Commands = \"\"
Commands = Commands & \"local integer l_file_id; \" & vbCrLf
Commands = Commands & \"local string pathname; \" & vbCrLf
Commands = Commands & \"pathname = Path_GetForApp(1) + \"\"TEMP.MAC\"\"; \" & vbCrLf
Commands = Commands & \"l_file_id = TextFile_Open(pathname, 0, 0); \" & vbCrLf
Commands = Commands & \"TextFile_WriteLine(l_file_id, \"\"CommandExec form BuiLtin command cmdQuitApplication\"\"); \" & vbCrLf
Commands = Commands & \"TextFile_Close(l_file_id); \" & vbCrLf
Commands = Commands & \"if File_Probe(pathname) then \" & vbCrLf
Commands = Commands & \" run macro pathname; \" & vbCrLf
Commands = Commands & \"end if; \" & vbCrLf
' Execute SanScript
CompilerError = CompilerApp.ExecuteSanscript(Commands, CompilerMessage)
If CompilerError <> 0 Then
MsgBox CompilerMessage
End If
End Sub"
EventMode "0"
Fields
{
}
Title "CheckLinks"
}
}
}
</Component>
Thanks
Vikram