Hello,
I am new to class modules and I'm trying to figure out how to run it. I am trying to use WithEvents and NewWindow2 to access a child window. WithEvents is only available in an object module, so I created a class module and added the following code:
Public WithEvents IE1 As InternetExplorer
Public IE2 As InternetExplorer
Private Sub CommandButton1_Click()
Dim strURL As String
Dim ieDoc As Object
strURL = "http://demos.telerik.com/aspnet-ajax/window/examples/overview/defaultcs.aspx"
Set IE1 = New InternetExplorer
Set IE2 = Nothing
With IE1
.navigate strURL
.Visible = True
While IE1.Busy: DoEvents: Wend
End With
Set ieDoc = IE2.document
'code to interact with IE2 goes here
End Sub
Private Sub IE1_NewWindow2(ppDisp As Object, Cancel As Boolean)
Set IE2 = New InternetExplorer
Set ppDisp = IE2.Application
End Sub
I then created a command button on Sheet1, however when I click the button nothing happens. I have attached a workbook with this example.
Thanks in advance,
Matt
Bookmarks