Results 1 to 12 of 12

Running a Class Module from a Button

Threaded View

  1. #1
    Registered User
    Join Date
    11-06-2013
    Location
    North Carolina
    MS-Off Ver
    Excel 2010
    Posts
    19

    Running a Class Module from a Button

    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
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] ComboBox class .AddItem filled in class module
    By Jacques Grobler in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-03-2012, 05:48 AM
  2. Replies: 1
    Last Post: 08-30-2011, 02:23 AM
  3. class module?
    By sybmathics in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 02-25-2006, 10:35 AM
  4. [SOLVED] Class Module
    By Bill Martin in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-25-2006, 05:00 PM
  5. [SOLVED] Class module
    By Avner Mediouni in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-19-2005, 11:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1