+ Reply to Thread
Results 1 to 3 of 3

Method 'ChangeLink of Object'_Workbook' failed

  1. #1
    Registered User
    Join Date
    09-20-2013
    Location
    las vegas, Nevada
    MS-Off Ver
    Excel 2003
    Posts
    4

    Method 'ChangeLink of Object'_Workbook' failed

    I've been struggling all day...searching the forum for answers with no luck! The last line below in the code errors with
    the message Method 'ChangeLink of Object'_Workbook' failed
    Appreciate you heros out there!




    Sub SETUP2()

    'set stop watch for timing macro elapsed time
    Dim myTime As Date, elapsedTime As Date, dblDuration As Double
    myTime = Time

    Dim source As Workbook
    Dim Prior, PCurrent, CrYear, CurrMonth, thiswkb As String
    Dim OldLnkPrior, OldLnkCur, NewLnkPrior, NewLnkCur As String
    Prior = ActiveSheet.Range("AB3")
    PCurrent = ActiveSheet.Range("AB2")
    CrYear = ActiveSheet.Range("AB4")
    CurrMonth = ActiveSheet.Range("AB1")
    NewLnkCur = "\\usnvfsa0\Accounting$\Office Records\Treasury\Balancing\" & CurrMonth & "\Balancing Data " & CurrMonth & ".xlsx"
    OldLnkCur = "\\usnvfsa0\Accounting$\Office Records\Treasury\Balancing\" & CurrMonth & "\Balancing Data " & PCurrent & ".xlsx"
    NewLnkPrior = "\\usnvfsa0\Accounting$\Office Records\Treasury\Balancing\" & CrYear & "\" & PCurrent & "\Balancing Data " & PCurrent & ".xlsx"
    OldLnkPrior = "\\usnvfsa0\Accounting$\Office Records\Treasury\Balancing\" & CrYear & "\" & Prior & "\Balancing Data " & Prior & ".xlsx"
    thiswkb = "Contracts Balancing " & CurrMonth

    Application.ScreenUpdating = False

    'to save macro performance run time, open current month Balancing Data source
    Set source = Workbooks.Open(NewLnkCur)
    Workbooks(thiswkb).Activate
    ThisWorkbook.ChangeLink OldLnkCur, NewLnkCur, xlLinkTypeExcelLinks

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Method 'ChangeLink of Object'_Workbook' failed

    Hi, smporco,

    please wrap your code with code-tags for better readability.

    AFAIK you would need to run through an array of the links and change them one after the other, and I´m not really sure if you want it updated in the workbook with the code (ThisWorkbook) or the active one (ActiveWorkbook):
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    09-20-2013
    Location
    las vegas, Nevada
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Method 'ChangeLink of Object'_Workbook' failed

    Thank you so much Holger! here's my working piece of code.

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Method 'CheckIn' of object '_workbook' failed
    By Bill Schanks in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-26-2014, 11:03 AM
  2. [SOLVED] runtime error 1004 method save of object _workbook failed
    By madhatter40 in forum Excel General
    Replies: 1
    Last Post: 06-22-2013, 07:30 AM
  3. [SOLVED] runtime error 1004 method save of object _workbook failed
    By madhatter40 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-20-2013, 03:37 AM
  4. [SOLVED] run time error 1004 method save as of object _workbook failed
    By johnsmith2004ad in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-21-2013, 02:02 AM
  5. method 'SaveAs' of object '_Workbook' failed
    By Kishi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-11-2006, 10:55 PM

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