Wait Method (ApplicationObject)
Waits for the specified duration.
This Microsoft Excel VBA sample shows how to use the Wait method to make sure Reflection has initialized when you open it from another application. It opens Reflection and creates a demo session. To run this sample:
On the Excel VBA Editor Tools menu, select References and then select the following Reflection Libraries:
- Attachmate_Reflection_Objects
- Attachmate_Reflection_Objects_Emulation_IbmHosts
- Attachmate_Reflection_Objects_Framework
Then copy the following code into an Excel Sheet object code window and press F5 to run the macro.
Public Sub OpenASessionFromMSExcel()
'Declare an object variable for the Reflection object
Dim app As Attachmate_Reflection_Objects_Framework.ApplicationObject
'Declare additional Reflection objects, such as frame, terminal, and view
Dim frame As Attachmate_Reflection_Objects.frame
Dim terminal As Attachmate_Reflection_Objects_Emulation_IbmHosts.IbmTerminal
Dim view As Attachmate_Reflection_Objects.view
'Create a new instance of Reflection
Set app = New Attachmate_Reflection_Objects_Framework.ApplicationObject
'wait until Reflection initializes
Do While app.IsInitialized = False
app.Wait (200)
Loop
'Create controls to open and display the session document.
Set frame = app.GetObject("Frame")
frame.Visible = True
Set terminal = app.CreateControl2("09E5A1B4-0BA6-4546-A27D-FE4762B7ACE1")
terminal.HostAddress = "demo:ibm3270.sim"
Set view = frame.CreateView(terminal)
Set screen = terminal.screen
End Sub