YasserKhalil
07-24-2017, 02:37 AM
Hello everyone
I have a workbook which I need to break all the links in it .. I have searched a lot and found some solutions but these solutions doesn't help me
I have used some codes to help me doing that task ..
Sub UnhideAllNames()
Dim objName As Name
If Not Application.ActiveWorkbook Is Nothing Then
For Each objName In Application.ActiveWorkbook.Names
objName.Visible = True
Next objName
End If
End Sub
Sub ListExternalLinks()
Dim wb As Workbook
Dim Link As Variant
Dim xIndex As Long
Set wb = Application.ActiveWorkbook
If Not IsEmpty(wb.LinkSources(xlExcelLinks)) Then
wb.Sheets.Add
xIndex = 1
For Each Link In wb.LinkSources(xlExcelLinks)
Application.ActiveSheet.Cells(xIndex, 1).Value = Link
xIndex = xIndex + 1
Next Link
End If
Columns(1).AutoFit
End Sub
Sub BreakExternalLinks()
Dim externalLinks As Variant
Dim wb As Workbook
Dim x As Long
Set wb = ActiveWorkbook
externalLinks = wb.LinkSources(Type:=xlLinkTypeExcelLinks)
For x = 1 To UBound(externalLinks)
wb.BreakLink Name:=externalLinks(x), Type:=xlLinkTypeExcelLinks
Next x
End Sub
I tried to unhide named ranges then deleted these hidden named ranges manually .. and run the code that beaks all the external links and nothing happened .. The external links are still there
Any help please
I have a workbook which I need to break all the links in it .. I have searched a lot and found some solutions but these solutions doesn't help me
I have used some codes to help me doing that task ..
Sub UnhideAllNames()
Dim objName As Name
If Not Application.ActiveWorkbook Is Nothing Then
For Each objName In Application.ActiveWorkbook.Names
objName.Visible = True
Next objName
End If
End Sub
Sub ListExternalLinks()
Dim wb As Workbook
Dim Link As Variant
Dim xIndex As Long
Set wb = Application.ActiveWorkbook
If Not IsEmpty(wb.LinkSources(xlExcelLinks)) Then
wb.Sheets.Add
xIndex = 1
For Each Link In wb.LinkSources(xlExcelLinks)
Application.ActiveSheet.Cells(xIndex, 1).Value = Link
xIndex = xIndex + 1
Next Link
End If
Columns(1).AutoFit
End Sub
Sub BreakExternalLinks()
Dim externalLinks As Variant
Dim wb As Workbook
Dim x As Long
Set wb = ActiveWorkbook
externalLinks = wb.LinkSources(Type:=xlLinkTypeExcelLinks)
For x = 1 To UBound(externalLinks)
wb.BreakLink Name:=externalLinks(x), Type:=xlLinkTypeExcelLinks
Next x
End Sub
I tried to unhide named ranges then deleted these hidden named ranges manually .. and run the code that beaks all the external links and nothing happened .. The external links are still there
Any help please