I want to execute 4 Rumba macros one by one using Excel VBA programming using ehlapi32 dll. I have come to know that there is WD_RunMacro function available to run macros of Rumba. The first parameter I passed as Window Handle and 2nd as Rumba Macro file fullpath. But I was not able to run the macros. I am using Rumba for last 7 or 8 days and have no prior experience in Rumba. Could any one help me in this regard. Thanks in advance.
#macros#Rumba#EHLAPI32#APIHi quark,
unfortunately the WD_RUNMACRO function returns immediately, it does not wait for the macro to complete execution. In order to synchronise the one by one execution of your macros from MS Excel you will need to have a mechanism in your macro to let Excel know once the macro has nears completion and then add a small wait before executing the next macro in your list.
e.g. use a temporary file to pause your VBA macro until the Rumba macro has completed.
'My VBA code
'Win32API DECLARATIONS
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
'HLLAPI FUNCTION DECLARATIONS
Private Declare Function WD_ConnectPS Lib "EhlApi32.dll" (ByVal hInstance As Integer, ByVal ShortName As String) As Integer
Private Declare Function WD_DisconnectPS Lib "EhlApi32.dll" (ByVal hInstance As Integer) As Integer
Private Declare Function WD_RunMacro Lib "EhlApi32.dll" (ByVal hInstance As Integer, ByVal Buffer As String) As Integer
Sub SyncMacroExecution()
Dim myInstance As Integer
retC = WD_ConnectPS(myInstance, "Z")
retC = WD_RunMacro(myInstance, "c:\\temp\\testMe1.RMC")
DirFile = "c:\\temp\\running"
Do While Len(Dir(DirFile)) > 0
Sleep 250
DoEvents
Loop
Sleep 100
retC = WD_RunMacro(myInstance, "c:\\temp\\testMe2.RMC")
retC = WD_DisconnectPS(myInstance)
End Sub
Then I have two small .bat file, create.bat and del.bat
create.bat contains
echo > c:\\temp\\running
del.bat contains
del c:\\temp\\running
So now we need to execute create.bat when launching the macro and execute del.bat before exiting the macro execution.

By adding the above Run Application commands at the start and end of each of macro I wish to run successively, I can now control the flow in Excel VBA.
Now the above is not perfect, but it should allow you to achieve your goal. You may want to have a methos of breaking the VBA macro execution in case you forget to add the Run Application "C:\\temp\\del.bat" command to one of your Rumba macros or the rumba macro execution fails to reach this command.
Tom
I want to execute 4 Rumba macros one by one using Excel VBA programming using ehlapi32 dll. I have come to know that there is WD_RunMacro function available to run macros of Rumba. The first parameter I passed as Window Handle and 2nd as Rumba Macro file fullpath. But I was not able to run the macros. I am using Rumba for last 7 or 8 days and have no prior experience in Rumba. Could any one help me in this regard. Thanks in advance.
#macros#Rumba#EHLAPI32#APIThank Tom for reply. Can you please give me reply for one more question: what is difference between WD_DeletePS and WD_Disconnect PS? The first one takes one parameter window handle while later one also short session name. But I am not sure about difference in their functionality.
I want to execute 4 Rumba macros one by one using Excel VBA programming using ehlapi32 dll. I have come to know that there is WD_RunMacro function available to run macros of Rumba. The first parameter I passed as Window Handle and 2nd as Rumba Macro file fullpath. But I was not able to run the macros. I am using Rumba for last 7 or 8 days and have no prior experience in Rumba. Could any one help me in this regard. Thanks in advance.
#macros#Rumba#EHLAPI32#APIHi quark,
my understanding of WD_DeletePS is that it closes the terminal session after disconnecting it from the API interface.
WD_DisconnectPS only disconnects the terminal session from the API interface. The host session remains open.
Tom
I want to execute 4 Rumba macros one by one using Excel VBA programming using ehlapi32 dll. I have come to know that there is WD_RunMacro function available to run macros of Rumba. The first parameter I passed as Window Handle and 2nd as Rumba Macro file fullpath. But I was not able to run the macros. I am using Rumba for last 7 or 8 days and have no prior experience in Rumba. Could any one help me in this regard. Thanks in advance.
#macros#Rumba#EHLAPI32#APIThanks Tom. I am not much aware about Rumba and in learning phase and your answers are helpful me much. Thanks again.