BreakLink

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

See the code below. I want to copy a sheet named "Report" to a new workbook.
Then I want to break all the links. I am gettin an error that says
"BreakLink of workbook failed" or something like that. any ideas?

Dim Nwb as Workbook
Set Nwb = Workbooks.Add

With Nwb
ThisWorkbook.Worksheets("Report").Copy after:=.Worksheet _
(.Worksheets.Count)
Dim LinkSource As String
LinkSource = ThisWorkbook.Path & ThisWorkbook.Name
.BreakLink Name:=LinkSource, Type:=xlLinkTypeExcelLinks
End With
 
Your code worked for me--after I fixed the typo
(.worksheetS(.worksheets.count)).

You may want to paste the actual portion of the code that failed.

And while you're testing links, make sure you have a copy of Bill Manville's
FindLink program:
http://www.oaltd.co.uk/MVP/Default.htm

You'll find it very useful.
 
the "s" was lost when i copied it over. here is the exact error I keep
getting:

Method 'BreakLink' of Object '_Workbook' failed

thanks for the link, but I still can't figure out why i'm getting an error
here.
 
I could get the error if there were no links or if the worksheet were protected.

If you do it manually, does that provide any hint?
 
Steve,
Which version of Excel do you have ?
Not supported in XL2K or before.

NickHK
 
I think it is this Dave the /

LinkSource = ThisWorkbook.Path & "/" & ThisWorkbook.Name
 
And when I tested, I hadn't saved the workbook--so the path was "".

Glad you got it working.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top