Results 1 to 9 of 9

Automation Error -2147417848 The object invoked has disconnected from its clients

Threaded View

  1. #1
    Registered User
    Join Date
    07-30-2014
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    21

    Automation Error -2147417848 The object invoked has disconnected from its clients

    Hi, this code was doing its job fine over the past 2 days. I didn't change anything. Now all of the sudden I keep getting this error. I've tried to find a solution to people with similar problem but it hasn't been successful....Please help!


    Sub Match_And_Rearrange_Columns()
        
        Dim counter As Long, Found As Range, Cell As Range
        Dim ws1 As Worksheet, ws2 As Worksheet
        
        Set ws1 = Sheets("Main")        'Match column headers on this sheet
        Set ws2 = Sheets("New Data")    'Rearrange columns on this sheet
        
        Application.ScreenUpdating = False
        
        counter = 1
        Application.CutCopyMode = False
        Application.FindFormat.Font.FontStyle = "Bold" 'match the format
        
        For Each Cell In ws1.Range("A1", ws1.Cells(1, Columns.Count).End(xlToLeft))
        
            Set Found = ws2.Rows(1).Find(What:=Cell.Value, _
                                         LookIn:=xlValues, _
                                         LookAt:=xlWhole, _
                                         MatchCase:=True, _
                                         SearchFormat:=True)
            If Not Found Is Nothing Then
                If Found.column <> counter Then
                    Found.EntireColumn.Cut
                    ws2.Columns(counter).Insert Shift:=xlToRight             '<----automation error!!!
                    Application.CutCopyMode = False
                End If
            Else
                ws2.Columns(counter).Insert Shift:=xlToRight
                ws2.Columns(counter).ColumnWidth = Cell.ColumnWidth
                ws2.Cells(1, counter).Value = Cell.Value
            End If
            
            counter = counter + 1
        Next Cell
        
        Application.ScreenUpdating = True
        
    End Sub
    Last edited by soranz; 04-16-2015 at 03:35 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Automation error , the object invoked has disconnected from its clients
    By lini1985 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-21-2014, 08:55 AM
  2. [SOLVED] Automation error Object invoked has disconnected from its clients
    By BobMillar in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-13-2014, 06:59 AM
  3. 2147417848 automation error the object invoked has disconnected from its clients
    By KasiaFavourite in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-12-2011, 10:44 AM
  4. -2147417848 automation error the object invoked has disconnected from its clients
    By ajaykgarg in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 11-12-2011, 08:10 AM
  5. [SOLVED] Automation Error : The Object Invoked Has Disconnected From Its Clients !!
    By donna.gough@hydro.com in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-17-2005, 09:05 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