Results 1 to 2 of 2

run-time error 91Object variable or With block variable not set

Threaded View

  1. #1
    Registered User
    Join Date
    07-28-2010
    Location
    london, england
    MS-Off Ver
    Excel 2007
    Posts
    91

    run-time error 91Object variable or With block variable not set

    Hi all I have the following code to link 3 comboboxes (active x controls):

    Private Sub Area_Change()
       
        If ActiveSheet.OLEObjects("Area").Object.Text <> "None" Then
            ActiveSheet.OLEObjects("Country").Object.Text = "None"
            ActiveSheet.OLEObjects("Textbox1").Object.Text = ""
            Range("I16").Value = ""
        End If
    End Sub
     
     
    Private Sub Country_Change()
       
        If ActiveSheet.OLEObjects("Country").Object.Text <> "None" Then
            ActiveSheet.OLEObjects("Area").Object.Text = "None"
            ActiveSheet.OLEObjects("Textbox1").Object.Text = ""
            Range("I16").Value = ""
        End If
    End Sub
     
     
    Private Sub TextBox1_Change()
        
        If ActiveSheet.OLEObjects("Textbox1").Object.Text <> "" Then
            ActiveSheet.OLEObjects("Country").Object.Text = "None"
            ActiveSheet.OLEObjects("Area").Object.Text = "None"
            Range("I16").Value = ActiveSheet.OLEObjects("Textbox1").Object.Text
        End If
    End Sub
    However when I close the work book I get 2 runtime errors in succcession. The lines affected are:
    If ActiveSheet.OLEObjects("Country").Object.Text <> "None" Then
    and
    If ActiveSheet.OLEObjects("Area").Object.Text <> "None" Then
    Any help in rosolving this would be greatly appreciated as it'd driving me mad!

    Thanks,
    james
    Attached Files Attached Files
    Last edited by j.farr3ll; 11-25-2012 at 04:29 PM.

Thread Information

Users Browsing this Thread

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

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