|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub BacthBreakLink() ' 批量断开链接
Dim Filename As Variant
Dim Thisbook As Workbook
Dim aLinks As Variant
Dim i, j
Application.AskToUpdateLinks = False
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Application.EnableEvents = False
Filename = Application.GetOpenFilename("Excel Files (*.xls), *.xls", , "打开要断开的表格", MultiSelect:=True)
If VarType(Filename) = vbBoolean Then Exit Sub
For i = 1 To UBound(Filename)
Set Thisbook = Workbooks.Open(Filename(i))
aLinks = Thisbook.LinkSources(Type:=xlLinkTypeExcelLinks)
If Not IsEmpty(aLinks) Then
For j = 1 To UBound(aLinks)
Thisbook.BreakLink Name:=aLinks(j), Type:=xlLinkTypeExcelLinks
Next j
End If
Thisbook.Close SaveChanges:=False
Set Thisbook = Nothing
Next i
Application.DisplayAlerts = True
Application.ScreenUpdating = True
Application.EnableEvents = True
Application.AskToUpdateLinks = True
End Sub
大家帮忙看下,这段批量断开链接的代码哪里有问题,为什么每次运行后,链接还是没有被断开
|
|