Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Las Vegas, Nevada, USA
    Posts
    334
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Break Link in a VBA macro (Excel 2003)

    I have recorded a macro to copy sheets of one workbook to email. I want to break the links to the original file in the copy. The recorded version is:
    ActiveWorkbook.BreakLink Name:= _
    "HATAPayroll_WeeklyWeekly_Payroll_2009-01-25.xls", Type:=xlExcelLinks

    I change the filename each week to create a new report and use the date as part of the filename.xls. How do I modify the recorded statement so that it is generic to anyfilename.xls?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Break Link in a VBA macro (Excel 2003)

    If you have links to only one workbook, you can use

    Dim src As Variant
    src = ActiveWorkbook.LinkSources(xlLinkTypeExcelLinks)
    ActiveWorkbook.BreakLink src(1), xlLinkTypeExcelLinks

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Las Vegas, Nevada, USA
    Posts
    334
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Re: Break Link in a VBA macro (Excel 2003)

    Thanks Hans. I thought you might have gone home for the day already. I shouldda known better.

    You really should consider writing that book.

Posting Permissions

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