I need help writing a macro that can toogle between Extra and Excel. I have macros in Extra that copies data and then I have a macro attached to a button that paste the data and formats it in a spreadsheet. I want the macro to actually copy the data, activate Excel spreadsheet, run excel macro and then return to Extra and pull next range of data. I know it is possible but cannot figure it out. This is what I have in Extra.
' Global variable declarations
Global g_HostSettleTime%
Global g_szPassword$
Sub Main()
'--------------------------------------------------------------------------------
' Get the main system object
Dim Sessions As Object
Dim System As Object
Set System = CreateObject("EXTRA.System") ' Gets the system object
If (System is Nothing) Then
Msgbox "Could not create the EXTRA System object. Stopping macro playback."
STOP
End If
Set Sessions = System.Sessions
If (Sessions is Nothing) Then
Msgbox "Could not create the Sessions collection object. Stopping macro playback."
STOP
End If
'--------------------------------------------------------------------------------
' Set the default wait timeout value
g_HostSettleTime = 3000 ' milliseconds
OldSystemTimeout& = System.TimeoutValue
If (g_HostSettleTime > OldSystemTimeout) Then
System.TimeoutValue = g_HostSettleTime
End If
' Get the necessary Session Object
Dim Sess0 As Object
Set Sess0 = System.ActiveSession
If (Sess0 is Nothing) Then
Msgbox "Could not create the Session object. Stopping macro playback."
STOP
End If
If Not Sess0.Visible Then Sess0.Visible = TRUE
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
' This section of code contains the recorded events
Dim Tran As Object
Dim MyScreen As Object
Set MyScreen = Sess0.Screen
Set Tran = MyScreen.Area(13,16,21,20,,3)
Tran.Select
Tran.Copy
'Sess0.Screen.WaitHostQuiet(100)
'Sess0.Screen.Select(13,20,20,40)
'Sess0.Screen.Copy
System.TimeoutValue = OldSystemTimeout
End Sub
' Global variable declarations
Global g_HostSettleTime%
Global g_szPassword$
Sub Main()
'--------------------------------------------------------------------------------
' Get the main system object
Dim Sessions As Object
Dim System As Object
Set System = CreateObject("EXTRA.System") ' Gets the system object
If (System is Nothing) Then
Msgbox "Could not create the EXTRA System object. Stopping macro playback."
STOP
End If
Set Sessions = System.Sessions
If (Sessions is Nothing) Then
Msgbox "Could not create the Sessions collection object. Stopping macro playback."
STOP
End If
'--------------------------------------------------------------------------------
' Set the default wait timeout value
g_HostSettleTime = 3000 ' milliseconds
OldSystemTimeout& = System.TimeoutValue
If (g_HostSettleTime > OldSystemTimeout) Then
System.TimeoutValue = g_HostSettleTime
End If
' Get the necessary Session Object
Dim Sess0 As Object
Set Sess0 = System.ActiveSession
If (Sess0 is Nothing) Then
Msgbox "Could not create the Session object. Stopping macro playback."
STOP
End If
If Not Sess0.Visible Then Sess0.Visible = TRUE
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
' This section of code contains the recorded events
Dim Tran As Object
Dim MyScreen As Object
Set MyScreen = Sess0.Screen
Set Tran = MyScreen.Area(13,16,21,20,,3)
Tran.Select
Tran.Copy
'Sess0.Screen.WaitHostQuiet(100)
'Sess0.Screen.Select(13,20,20,40)
'Sess0.Screen.Copy
System.TimeoutValue = OldSystemTimeout
End Sub