Here is a little code I use to do something similar....
I think this is what your intending to do.
'--------------------------------------------------------------------------------
' This macro was created by Christadelphian
' Session Document: "CSS.EDP"
' Date: Saturday, January 19, 2008
'
'--------------------------------------------------------------------------------
' Global variable declarations
Global g_HostSettleTime%
Global g_szPassword$
Sub Main()
'--------------------------------------------------------------------------------
Dim Explorer As Object
Dim Sess0 As Object
Dim Sys As Object
Dim Sessions As Object
Dim System As Object
Dim result As String
Dim surname As String
Dim ouc As String
Dim JobNo As String
Dim UserId As String
SessName0$ = "CSS.Edp"
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 = 30 ' milliseconds
OldSystemTimeout& = System.TimeoutValue
If (g_HostSettleTime > OldSystemTimeout) Then
System.TimeoutValue = g_HostSettleTime
End If
' Get the necessary Session 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)
'---------------------------------------------------------------------------------
'Read Job Number To Revert Extra! Back To
JobNo = Sess0.Screen.GetString(4, 62, 9)
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
If JobNo ="" Then
MsgBox "You must Be Within The DAP screen For this to Return you to your current job"
End If
'Stores User Id For Later Use
Sess0.Screen.Copy
Sess0.Screen.Sendkeys("<Reset><Home>zdud<Enter>") ' Navigates to User Details
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Paste
Sess0.Screen.Sendkeys("<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
'Initialise Internet Explorer Application
Set Explorer = CreateObject("InternetExplorer.Application")
With Explorer
.Visible = False
.Navigate "the_address_for_the_page_you wish_to_search_on_goes_here.html"
End With
If (Explorer is Nothing) Then
Msgbox "Could not create the IE object. Stopping Program."
STOP
End If
'Populates the necessary variables from Extra!
' Read Surname From Extra!
surname = Sess0.Screen.GetString(12, 25, 8)
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
' Read OUC From Extra!
ouc = Sess0.Screen.GetString(13, 25, 6)
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Reset><Home>DAP<Tab>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys(JobNo)
Sess0.Screen.Sendkeys("<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Explorer.Document.Forms.surname.Value = surname
Explorer.Document.Forms.org_unit.Value = ouc
Explorer.Visible = True
Explorer.Document.Forms.submit
System.TimeoutValue = OldSystemTimeout
End Sub