Results 1 to 3 of 3

Run-Time Error 1004 on Certain Machines

Threaded View

  1. #1
    Forum Contributor yay_excel's Avatar
    Join Date
    08-12-2011
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    190

    Run-Time Error 1004 on Certain Machines

    We have a macro-enabled template which has been working fine on all machines in the office for ages. Recently, on certain machines only, it has produced "Run-time error 1004: Unable to get the Object property of the OLEObject class."

    It works on one machine with Windows 7 Professional installed running the Home & Business 2013 version of Excel. It does not work on another Windows 7 Pro machine running the Professional Plus 2013 version of Excel.

    The code which seems to be producing the error:

    Option Explicit
    
    Dim ComboBoxes() As New ITEM_COMBOBOXES
    
    Sub InitializeBoxClass()
    
        Dim Obj As OLEObject
        Dim ComboBox_Count As Integer
    
        For Each Obj In PO_CREATION_WS.OLEObjects
            If TypeName(Obj.Object) = "ComboBox" Then  'DEBUGGER HIGHLIGHTS THIS LINE
                ComboBox_Count = ComboBox_Count + 1
                ReDim Preserve ComboBoxes(1 To ComboBox_Count)
                Set ComboBoxes(ComboBox_Count).ITEM_COMBOBOXES = Obj.Object
                Obj.ListFillRange = "ITEM_LIST"
            End If
       Next Obj
    End Sub
    I have tried referencing the OLEObjects by their index numbers instead of as a collection. This produces another error (not the same error as before). I have tried activating each OLEObject prior to retrieving its properties; another error code. I have tried adjusting the security settings in many different ways with no luck.

    Does anyone have any idea what went wrong?


    (Just in case, here is the ITEM_COMBOBOXES class)
    Option Explicit
    
    Public WithEvents ITEM_COMBOBOXES As MSForms.ComboBox
    
    Private Sub ITEM_COMBOBOXES_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
    
    With ActiveSheet
        Select Case KeyCode
        Case vbKeyTab
            If Shift = 1 Then 'SHIFT PRESSED, SHIFT TAB MOVES BACKWARD
                If Me.ITEM_COMBOBOXES.Index = 3 Then 'FIRST BOX SELECTED
                    .OLEObjects(.OLEObjects.Count).Activate 'GO TO END
                Else 'NOT FIRST BOX, MOVE BACK ONE
                    .OLEObjects(Me.ITEM_COMBOBOXES.Index - 1).Activate
                End If
            Else 'NO SHIFT KEY, TAB MOVES FORWARD
                If Me.ITEM_COMBOBOXES.Index = .OLEObjects.Count Then 'LAST BOX SELECTED
                    .OLEObjects(3).Activate 'GO TO TOP
                Else 'NOT LAST BOX, MOVE FORWARD ONE
                    .OLEObjects(Me.ITEM_COMBOBOXES.Index + 1).Activate
                End If
            End If
        Case vbKeyLeft
            Range("A" & Me.ITEM_COMBOBOXES.Index - 1).Activate
        Case vbKeyRight
            Range("C" & Me.ITEM_COMBOBOXES.Index - 1).Activate
        Case vbKeyDelete
            Me.ITEM_COMBOBOXES.Value = ""
        End Select
    End With
    End Sub
    Last edited by yay_excel; 01-17-2015 at 01:40 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Sort Macro Run-time error '1004': Application/Object-defined error.
    By sam1212 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-22-2014, 10:05 AM
  2. Replies: 4
    Last Post: 11-15-2013, 05:03 PM
  3. Error "run-time Error '1004': General Odbc Error
    By D4WNO77 in forum Access Tables & Databases
    Replies: 2
    Last Post: 07-16-2012, 09:55 AM
  4. Macros giving Run-time error '9' on all machines except mine
    By WinterCoast in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-17-2008, 12:56 PM
  5. [SOLVED] run-time error '1004': Application-defined or object-deifined error
    By rich5665@gmail.com in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-10-2005, 05:05 PM

Tags for this Thread

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