dcsimg
Results 1 to 3 of 3

Thread: [RESOLVED] [Excel 2010 VBA] activeworkbook.breaklink

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2010
    Posts
    14

    Resolved [RESOLVED] [Excel 2010 VBA] activeworkbook.breaklink

    I need help getting activeworkbook.breaklink to work.

    I am trying to write a piece of VBA which breaks all the links in workbook (all the links are to a MS-SQL database).

    This code:
    Code:
    Dim objWBConnect As Object
    For Each objWBConnect In ActiveWorkbook.Connections
        ActiveWorkbook.BreakLink objWBConnect.Name, objWBConnect.Type
    Next objWBConnect
    Produces the error message:
    Method BreakLink of object '_Workbook' failed

    Note that objWBConnect.Name & objWBConnect.Type contain valid values (Adjustments & 1 respectively)

  2. #2

    Thread Starter
    New Member
    Join Date
    Nov 2010
    Posts
    14

    Re: [Excel 2010 VBA] activeworkbook.breaklink

    Solved it myself!

    This works:

    Code:
    Dim objWBConnect As Object
    For Each objWBConnect In ActiveWorkbook.Connections
        ActiveWorkbook.Connections(objWBConnect.Name).Delete
    Next objWBConnect

  3. #3
    Frenzied Member
    Join Date
    Jan 2010
    Location
    Connecticut
    Posts
    1,687

    Re: [Excel 2010 VBA] activeworkbook.breaklink

    Excellent, nice job!! Since you resolved your issue can you please mark your thread RESOLVED.
    VB6 Library

    If I helped you then please help me and rate my post!
    If you solved your problem, then please mark the post resolved

Tags for this Thread

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width