title: How to cleanly break links in Excel VBA 2010
body: <p>I'm trying to programmatically break all links, then recreate them in a workbook.</p>
  
  <p>I got some VBA code to cleanly break Excel links in Excel 2010, however the trouble I always have is that Excel will prompt me every time I RECREATE the link.</p>
  
  <p>Here's what I'm doing:</p>
  
  <p>Here's the BreakLinks procedure :</p>
  
  <pre><code>Sub BreakLinks()
      vLinks = ActiveWorkbook.LinkSources(Type:=xlLinkTypeExcelLinks)
  
      ' Break all links in the active workbook.
      For lLink = LBound(vLinks) To UBound(vLinks)
          ActiveWorkbook.BreakLink _
              Name:=vLinks(lLink), _
              Type:=xlLinkTypeExcelLinks
      Next lLink
  end sub
  </code></pre>
  
  <p>Here's the Main section: 
     <em>*</em> Please note that the last line where I assign thisFormula is where Excel prompts me with a File Dialog box which forces me to either cancel or choose my Master Workbook I'm linking back to...</p>
  
  <pre><code>    BreakLinks    ' call proc to break the links
      thisFormula = "='[DataMaster - Data Template.xlsm]MASTER'!$B" + Trim(Str(myRow))     ' reference back to master workbook
      Range("A1").Formula = thisFormula       ' i.e. "='[DataMaster - Data Template.xlsm]MASTER'!$B32"
      Range("B1").Formula = "=D1"
      Range("C1").Formula = "=E1/100"
      thisFormula = "=BDH('[DataMaster - Data Template.xlsm]MASTER'!$A" + Trim(Str(myRow)) + "," + charCode + "PX_LAST" + charCode + ",FirstDate," + charCode + " " + charCode + "," + charCode + "cols=2;rows=50" + charCode + ")"
      Range("D1").Formula = thisFormula
  </code></pre>
  
  <p>I'd like to know how to avoid this very annoying Excel prompt, and just cleanly recreate my Formula/Link.</p>