I will try and explain this the best way I can:-

I have the following code
Code:
Private Declare Function FindWindow _
Lib "user32" _
Alias "FindWindowA" _
(ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function ShowWindow _
Lib "user32" _
(ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
Private Const SW_SHOWNORMAL = 1
Private Const SW_SHOWMINIMIZED = 2
Private Const SW_SHOWMAXIMIZED = 3
Private Sub Command1_Click()
Dim lHwnd As Long
Dim objIE As Object

lHwnd = FindWindow(vbNullString, ByVal "Google - Microsoft Internet Explorer")
If lHwnd <> 0 Then
MsgBox "IE Window is open!", vbInformation, "Google"
ShowWindow lHwnd, SW_SHOWNORMAL
'objIE = lHwnd
'objIE.document.Form("q").Value = "test"
Else
MsgBox "Internet Explorer isn't open!", vbInformation, "Window not found."



End If

End Sub
Which finds and returns an open Internet Explorer window.
I have tried to create a reference to lHwnd as an object using the code in bold.
Because i want to input some data in a form on the required web page. Using 'objIE.document.Form("q").Value = "test"

But I keep getting an error saying object variable or with block variable not set.

Is it possible to make an object reference to lHwnd.
I am using Google as test website, to get me familiar with forms.