VBA help

H

Hitesh Joshi

hi,

I want to open a form that has web browser object. I put small snippet
of code for a commnd button on my main form... but I am getting cannot
find referred expression error in this line Set wb =
Me!WebBrowser0.Object


Private Sub CRM_Click()
On Error GoTo Err_CRM_Click


Dim stDocName As String
Dim stLinkCriteria As String
Dim wb As SHDocVw.WebBrowser_V1


stDocName = "FrmCRM"
DoCmd.OpenForm stDocName, , , stLinkCriteria


Set wb = Me!WebBrowser0.Object


With wb
' .Navigate Me.URL
.Navigate "http://crm/login.asp"


Do While .Busy: DoEvents: Loop
Do While .ReadyState <> 4: DoEvents: Loop


With .Document.Forms(0)
' Set the dates.
.username.Value = "username"
.password.Value = "password"
' Click Submit to run the report.
.submit
End With
End With
Set wb = Nothing


Exit_CRM_Click:
Exit Sub


Err_CRM_Click:
MsgBox Err.Description
Resume Exit_CRM_Click


End Sub


thank you
hj
 
Top