在Excel工作簿中找不到链接 [英] Can't find link in Excel Workbook

查看:242
本文介绍了在Excel工作簿中找不到链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一个宏来打开几个受密码保护的工作簿。工作簿都有彼此之间的链接,所以为了方便起见,我设置了 UpdateLinks = = ,以便我没有收到所有链接更新的密码提示在其他书籍打开之前。



所有的工作簿都打开后,我试图使用


$ b $更新链接更新链接类型:= 1
工作簿(Workbook2)UpdateLink类型:= 1
工作簿(Workbook3 ).UpdateLink类型:= 1
工作簿(Workbook4)。UpdateLink类型:= 1

这是更方便的,因为工作簿现在已经开放,所以不需要密码提示。



这两个工作簿的工作正常,但另外两个提示我找到不存在的链接的来源..这是工作簿中不存在的实际链接。



我花了几个小时试图找出哪里它正在获得这个链接,但它根本不存在任何地方。

为了使这一点更清楚,在工作簿2中,我有三个链接A,B和C.这些在数据>编辑链接菜单中可见。但是,当我运行宏,它要求我找到链接的源E ...



我已经尝试下面看看是否有一个链接不可见由于某种原因

 工作簿(Workbook2)。激活

aLinks = ActiveWorkbook.LinkSources(1 )
如果不是IsEmpty(aLinks)然后
对于i = 1到UBound(aLinks)
MsgBoxLink&我& :& Chr(13)& aLinks(i)
Next i
如果

这只是向我显示我可以在编辑链接中看到三个。



我在工作簿中搜索了该链接的名称,以便我找到该文件并没有任何内容。 / p>

有没有人看过这个或有任何想法?

解决方案

可以创建工作簿之间的链接(on目的或意外)以多种方式:

  1。在公式
内部范围名称
3.内部图表范围

Excel用户通常熟悉(1),并搜索引用链接的文本,但这不会检测图表和范围名称中的链接。



Bill Manville的 findlink 是查找和/或删除这些链接的独特解决方案。



下载插件,选择带有链接的文件,从Excel运行加载项(Bill的页面上的说明),然后




  • 在下拉框中选择您要查找的引用

  • 我选择查找的选项,然后列出链接



各种链接类型的示例





示例输出





几年前,我写了一个自己的链接查找器,以下代码,以证明其使用



代码

 code> Option Explicit 

'此代码搜索ActiveWorkbook中的所有工作表(工作表和图表表)链接
',并编译过滤的CSV文件以报告任何:
'#1公式链接(并对链接资源进行验证)
'#2范围名称链接
'#3数据透视表链接
'#4a图表系列链接(在图表和图表中)在常规工作表上)
'#4b图表标题链接(在正常工作表中的图表和图表)

'下载Bill Manville的FindLink在http://www.bmsltd.co.uk $ m
'用于管理(即删除)链接的工具

'Notes
'1)图表标题方法依赖于激活图表。
'--->受保护的工作表被跳过
'--->这个方法在xl2007
'2中不起作用2)我已经故意省略了错误处理,因为我想解决任何问题

Sub ListLinks()
Dim objFSO As Object,objFSOfile作为对象
Dim wb As Workbook,sh
Dim rng1 As Range,rng2 As Range,rng3 As Range,rArea As Range
Dim chr As ChartObject,chr1 As Chart
Dim lSource ,PivCh,chrSrs
Dim FSOFileHeader As String,tmpStr As String,chrTitle As String,FirstAddress As String,ReportFile As String,ShProt As String
Dim nameCnt As Long
Dim FndRngLink As Boolean,FndChrLink作为Boolean,FndNameLink As Boolean,FndPivLink As Boolean

Application.ScreenUpdating = False
'报告文件的位置
ReportFile =c:\LinkReport.csv
FSOFileHeader =类型,对象级别,位置,链接工作簿,完整链接文件路径,参考

设置objFSO = CreateObject(scripting.filesystemobject)
错误恢复下一步
'如果报告文件打开然后要求用户关闭它
设置objFSOfile = objFSO.createtextfile(ReportFile)
如果Err.Number<> 0然后
MsgBoxPls close& vbNewLine& ReportFile& vbNewLine& 然后重新运行代码
Exit Sub
End If
On Error GoTo 0

'写报告文件头
带objFSOfile
活动ActiveWorkbook.Path& ,& ActiveWorkbook.Name
.writeline FSOFileHeader
结束

对于每个sh在ActiveWorkbook.Sheets

选择案例sh.Type
案例xlWorksheet
'查看每个工作表中的公式单元格
设置rng1 =没有
设置rng2 =没有
设置rng3 =没有

错误恢复下一步
设置rng1 = sh.Cells.SpecialCells(xlCellTypeFormulas)
错误GoTo 0
Application.StatusBar =在表格中搜索公式& sh.Name
如果不是rng1不是然后
'寻找* .xls
用rng1
设置rng2 = .Find(*。xls,LookIn:= xlFormulas, LookAt:= xlPart,SearchOrder:= xlByRows,MatchCase:= False)
如果不是rng2是没有,然后
FirstAddress = rng2.Address
'验证* .xls是链接源的一部分
对于每个lSource在ActiveWorkbook.LinkSources
'查找打开和关闭的工作簿
如果InStr(替换(rng2.Formula,[,vbNullString),lSource)> 0或InStr(rng2.Formula,Right $(rng2.Formula,Len(lSource))--InStrRev(lSource,\)))> 0然后
FndRngLink = True
'写入报告文件
设置rng3 = rng2
退出
结束如果
下一个
'重复直到代码循环回包含* .xls的第一个公式单元格
Do
设置rng2 = .FindNext(rng2)
如果rng2.Address<> FirstAddress然后
对于每个lSource在ActiveWorkbook.LinkSources
如果InStr(替换(rng2.Formula,[,vbNullString),lSource)> 0或InStr(rng2.Formula,Right $(lSource,Len(lSource))--InStrRev(lSource,\)))> 0然后
设置rng3 =联合(rng3,rng2)
退出
结束如果
下一个
结束如果
循环直到rng2.Address = FirstAddress
结束如果
结束
结束如果

如果不是rng3是没有然后
对于每个rArea在rng3.Areas
objFSOfile.writeline公式& 范围& ,& sh.Name& ! &安培; Replace(rArea.Address(0,0),,,;)& ,&右$(lSource,Len(lSource) - InStrRev(lSource,\))& ,&来源& ,& rng3.Cells(1).Formula
下一个
结束如果

'图表
对于每个chr在sh.ChartObjects
Application.StatusBar =搜索图表& sh.Name
对于每个chrSrs在chr.Chart.SeriesCollection
如果InStr(chrSrs.Formula,.xls)<> 0然后
对于每个lSource在ActiveWorkbook.LinkSources
'查看打开和关闭的工作簿
如果InStr(替换(chrSrs.Formula,[,vbNullString),lSource)> 0或InStr(chrSrs.Formula,Right $(lSource,Len(lSource) - InStrRev(lSource,\)))> 0然后
FndChrLink = True
'写入报告文件
objFSOfile.writeline图表系列& chr.Name& ,& sh.Name& ,&右$(lSource,Len(lSource) - InStrRev(lSource,\))& ,&来源& ,&替换(chrSrs.Formula,,,;)
退出
结束如果
下一个
结束如果
下一个chrSrs

如果chr.Chart.HasTitle然后
如果sh.ProtectContents = True然后
ShProt = ShProt& sh.Name& - & chr.Name& vbNewLine
Else
chr.Activate
chrTitle = CStr(ExecuteExcel4Macro(GET.FORMULA(Title)))
如果InStr(chrTitle,.xls )< 0然后
对于每个lSource在ActiveWorkbook.LinkSources
'查看打开和关闭的工作簿
如果InStr(替换(chrTitle,[,vbNullString),lSource)> 0或InStr(chrTitle,Right $(lSource,Len(lSource))--InStrRev(lSource,\)))> 0然后
FndChrLink = True
'写入报告文件
objFSOfile.writeline图表标题& chr.Name& ,& sh.Name& ,&右$(lSource,Len(lSource) - InStrRev(lSource,\))& ,&来源& ,& chrTitle
退出
结束如果
下一个
结束如果
结束如果
结束如果

下一个chr

'数据透视表
对于每个PivCh在sh.PivotTables
如果InStr(PivCh.SourceData,.xls)> 0然后
对于ActiveWorkbook.LinkSources
中的每个lSource如果InStr(Replace(PivCh.SourceData,[,vbNullString],lSource)> 0或InStr(PivCh.SourceData,Right $(lSource,Len(lSource)) - InStrRev(lSource,\)))> 0然后
objFSOfile.writelinePivot Table,& PivCh.Name& ,& sh.Name& ,&右$(lSource,Len(lSource) - InStrRev(lSource,\))& ,&来源& ,& PivCh.SourceData
FndPivLink = True
退出
结束如果
下一个
结束如果
下一个
案例3
设置chr1 =没有
在错误恢复下一步
设置chr1 = sh
错误GoTo 0
如果不是chr1是没有,然后
Application.StatusBar =在表格中搜索图表 &安培; sh.Name
对于每个chrSrs在chr1.SeriesCollection
如果InStr(chrSrs.Formula,.xls)<> 0然后
对于每个lSource在ActiveWorkbook.LinkSources
'查看打开和关闭的工作簿
如果InStr(替换(chrSrs.Formula,[,vbNullString),lSource)> 0或InStr(chrSrs.Formula,Right $(lSource,Len(lSource) - InStrRev(lSource,\)))> 0然后
FndChrLink = True
'写入报告文件
objFSOfile.writeline图表系列,图表表& sh.Name& ,&右$(lSource,Len(lSource) - InStrRev(lSource,\))& ,&来源& ,&替换(chrSrs.Formula,,,;)
退出
结束如果
下一个
结束如果
下一个

如果chr1.HasTitle然后
chr1.Activate
chrTitle = CStr(ExecuteExcel4Macro(GET.FORMULA(Title)))
如果InStr(chrTitle,.xls) <> 0然后
对于每个lSource在ActiveWorkbook.LinkSources
'查找打开和关闭的工作簿
如果InStr(替换(chrTitle,[,vbNullString),lSource)> 0或InStr(chrTitle,Right $(lSource,Len(lSource))--InStrRev(lSource,\)))> 0然后
FndChrLink = True
'写入报告文件
objFSOfile.writeline图表标题,图表表& sh.Name& ,&右$(lSource,Len(lSource) - InStrRev(lSource,\))& ,&来源& ,&替换(chrTitle,,,;)
退出
结束如果
下一个
如果
结束If
End If
Case Else
End Select
'End If
Next sh

'命名范围
如果ActiveWorkbook.Names.Count = 0然后
Else
Application.StatusBar =搜索范围名称
对于nameCnt = 1到ActiveWorkbook.Names.Count
如果InStr(ActiveWorkbook.Names(nameCnt),.xls)& ; 0然后
对于ActiveWorkbook.LinkSources
中的每个lSource如果InStr(替换(ActiveWorkbook.Names(nameCnt),[,vbNullString),lSource)> 0或InStr(ActiveWorkbook.Names(nameCnt),Right $(lSource,Len(lSource))--InStrRev(lSource,\)))> 0然后
FndNameLink = True
'写入报告文件
objFSOfile.writelineRange Name,& 工作簿级别& ActiveWorkbook.Names(nameCnt).Name& ,&右$(lSource,Len(lSource) - InStrRev(lSource,\))& ,&来源& ,& ActiveWorkbook.Names(nameCnt).RefersTo
退出
结束如果
下一个
'名称链接不存在于已知链接
如果FndNameLink = False然后
FndNameLink = True
objFSOfile.writelineRange Name,& 工作簿级别& ActiveWorkbook.Names(nameCnt).Name& ,& ActiveWorkbook.Names(nameCnt)& ,&替换(ActiveWorkbook.Names(nameCnt).RefersTo,,,;)
如果
结束If If
Next nameCnt
End If

关闭报告文件
objFSOfile.Close
设置objFSO = Nothing

'如果至少找到一个单元格链接,则打开报告文件
如果(FndChrLink = FndNameLink = FndRngLink = FndPivLink)和FndRngLink = False然后
MsgBox找不到公式链接,vbCritical
Else
设置wb = Workbooks.Open(ReportFile)
使用wb.Sheets (1)
.Rows(1:2)。Font.Bold = True
.Columns(A:F)。AutoFit
。[A2] .AutoFilter
结束与
结束如果
与应用程序
.StatusBar = vbNullString
.DisplayAlerts = True
结束与
如果ShProt<> vbNullString Then MsgBox以下表格被保护& vbNewLine& 所以这些图表标题无法搜索& vbNewLine& ShProt,vbCritical
End Sub


I've written a macro to open several password protected workbooks. The workbooks all have links between each other so for the sake of convenience, I've set UpdateLinks:=0 so that I do not get prompted for passwords for all the link updates, before the other books have opened.

After all the workbooks are open, i am trying to then update the links using

Workbooks("Workbook1").UpdateLink Type:=1
Workbooks("Workbook2").UpdateLink Type:=1
Workbooks("Workbook3").UpdateLink Type:=1
Workbooks("Workbook4").UpdateLink Type:=1

This is more convenient since the workbooks are now open so no password prompt is required.

This works fine on two of the workbooks but the other two are prompting me to locate the source of a link which does not exist.. That is the actual link does not exist in the workbook..

I've spent hours trying to figure out where it is getting this link from but it simply does not exist anywhere..

To make this more clear, in workbook 2 I have three links A, B, and C. These are visible in the Data > Edit links menu. However, when i run the macro it asks me to locate the source of link E...

I've tried the below to see if there is a link not visible for some reason

Workbooks("Workbook2").Activate

aLinks = ActiveWorkbook.LinkSources(1)
If Not IsEmpty(aLinks) Then
    For i = 1 To UBound(aLinks)
        MsgBox "Link " & i & ":" & Chr(13) & aLinks(i) 
    Next i
End If

This just shows me the three I can see in Edit Links.

I've searched the workbook for the name of the link it's trying to get me to locate the file for and nothing..

Has anyone seen this before or got any ideas? it's got me stumped and has made what should have been a simple job really frustrating.

解决方案

Links between workbooks can be created (on purpose or by accident) in a number of ways:

1. Within formulae 
2. Inside range names
3. Inside chart ranges

Excel users are typically familiar with (1), and searching for text that references the links, but this wont detect links in charts and range names.

Bill Manville's findlink is the standout solution for finding and/or removing these links.

Download the addin, select the file with the links, run the addin from Excel (instructions on Bill's page) and then

  • select the reference you are looking to find in the drop-down box
  • I pick the option that finds and then lists the links

sample of various link types

sample output

Some years back I had a crack at writing my own link finder, code below in case it proves of use

code

Option Explicit

' This code searches all sheets (worksheets and chart sheets) in the ActiveWorkbook for links
' and compiles a filtered CSV file to report on any:
' #1 Formula links (and validates them against linksources)
' #2 Range Name links
' #3 PivotTable links
' #4a Chart Series links (in both Chart Sheets and Charts on regular Worksheets)
' #4b Chart Title links (in both Chart Sheets and Charts on regular Worksheets)

' Download Bill Manville's FindLink at http://www.bmsltd.co.uk/MVP/Default.htm
' for a tool to manage (ie delete) links

' Notes
' 1) The Chart title method relies on activating the Chart.
'         ---> Protected sheets are skipped
'         ---> This method does not work in xl2007
' 2) I have deliberately left out error handling as I want to resolve any issues

Sub ListLinks()
    Dim objFSO As Object, objFSOfile As Object
    Dim wb As Workbook, sh
    Dim rng1 As Range, rng2 As Range, rng3 As Range, rArea As Range
    Dim chr As ChartObject, chr1 As Chart
    Dim lSource, PivCh, chrSrs
    Dim FSOFileHeader As String, tmpStr As String, chrTitle As String, FirstAddress As String, ReportFile As String, ShProt As String
    Dim nameCnt As Long
    Dim FndRngLink As Boolean, FndChrLink As Boolean, FndNameLink As Boolean, FndPivLink As Boolean

    Application.ScreenUpdating = False
    'location of report file
    ReportFile = "c:\LinkReport.csv"
    FSOFileHeader = "Type,Object Level,Location,Linked Workbook,Full Linked File Path,Reference"

    Set objFSO = CreateObject("scripting.filesystemobject")
    On Error Resume Next
    'if report file is open then ask user to close it
    Set objFSOfile = objFSO.createtextfile(ReportFile)
    If Err.Number <> 0 Then
        MsgBox "Pls close " & vbNewLine & ReportFile & vbNewLine & "then re-run code"
        Exit Sub
    End If
    On Error GoTo 0

    'write report file headers
    With objFSOfile
        .writeline ActiveWorkbook.Path & "," & ActiveWorkbook.Name
        .writeline FSOFileHeader
    End With

    For Each sh In ActiveWorkbook.Sheets

        Select Case sh.Type
        Case xlWorksheet
            'look at formula cells in each worksheet
            Set rng1 = Nothing
            Set rng2 = Nothing
            Set rng3 = Nothing

            On Error Resume Next
            Set rng1 = sh.Cells.SpecialCells(xlCellTypeFormulas)
            On Error GoTo 0
            Application.StatusBar = "Searching formulas in sheet " & sh.Name
            If Not rng1 Is Nothing Then
                'look for *.xls
                With rng1
                    Set rng2 = .Find("*.xls", LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False)
                    If Not rng2 Is Nothing Then
                        FirstAddress = rng2.Address
                        'validate that the *.xls is part of a linksource
                        For Each lSource In ActiveWorkbook.LinkSources
                            'look in open and closed workbooks
                            If InStr(Replace(rng2.Formula, "[", vbNullString), lSource) > 0 Or InStr(rng2.Formula, Right$(rng2.Formula, Len(lSource) - InStrRev(lSource, "\"))) > 0 Then
                                FndRngLink = True
                                'write to the report file
                                Set rng3 = rng2
                                Exit For
                            End If
                        Next
                        'repeat till code loops back to first formula cell containing "*.xls"
                        Do
                            Set rng2 = .FindNext(rng2)
                            If rng2.Address <> FirstAddress Then
                                For Each lSource In ActiveWorkbook.LinkSources
                                    If InStr(Replace(rng2.Formula, "[", vbNullString), lSource) > 0 Or InStr(rng2.Formula, Right$(lSource, Len(lSource) - InStrRev(lSource, "\"))) > 0 Then
                                        Set rng3 = Union(rng3, rng2)
                                        Exit For
                                    End If
                                Next
                            End If
                        Loop Until rng2.Address = FirstAddress
                    End If
                End With
            End If

            If Not rng3 Is Nothing Then
                For Each rArea In rng3.Areas
                    objFSOfile.writeline "Formula," & "Range" & "," & sh.Name & "!" & Replace(rArea.Address(0, 0), ",", ";") & "," & Right$(lSource, Len(lSource) - InStrRev(lSource, "\")) & "," & lSource & ",'" & rng3.Cells(1).Formula
                Next
            End If

            ' Charts
            For Each chr In sh.ChartObjects
                Application.StatusBar = "Searching charts in sheet " & sh.Name
                For Each chrSrs In chr.Chart.SeriesCollection
                    If InStr(chrSrs.Formula, ".xls") <> 0 Then
                        For Each lSource In ActiveWorkbook.LinkSources
                            'look in open and closed workbooks
                            If InStr(Replace(chrSrs.Formula, "[", vbNullString), lSource) > 0 Or InStr(chrSrs.Formula, Right$(lSource, Len(lSource) - InStrRev(lSource, "\"))) > 0 Then
                                FndChrLink = True
                                'write to the report file
                                objFSOfile.writeline "Chart Series," & chr.Name & "," & sh.Name & "," & Right$(lSource, Len(lSource) - InStrRev(lSource, "\")) & "," & lSource & ",'" & Replace(chrSrs.Formula, ",", ";")
                                Exit For
                            End If
                        Next
                    End If
                Next chrSrs

                If chr.Chart.HasTitle Then
                    If sh.ProtectContents = True Then
                        ShProt = ShProt & sh.Name & " - " & chr.Name & vbNewLine
                    Else
                        chr.Activate
                        chrTitle = CStr(ExecuteExcel4Macro("GET.FORMULA(""Title"")"))
                        If InStr(chrTitle, ".xls") <> 0 Then
                            For Each lSource In ActiveWorkbook.LinkSources
                                'look in open and closed workbooks
                                If InStr(Replace(chrTitle, "[", vbNullString), lSource) > 0 Or InStr(chrTitle, Right$(lSource, Len(lSource) - InStrRev(lSource, "\"))) > 0 Then
                                    FndChrLink = True
                                    'write to the report file
                                    objFSOfile.writeline "Chart Title," & chr.Name & "," & sh.Name & "," & Right$(lSource, Len(lSource) - InStrRev(lSource, "\")) & "," & lSource & ",'" & chrTitle
                                    Exit For
                                End If
                            Next
                        End If
                    End If
                End If

            Next chr

            'Pivot Tables
            For Each PivCh In sh.PivotTables
                If InStr(PivCh.SourceData, ".xls") > 0 Then
                    For Each lSource In ActiveWorkbook.LinkSources
                        If InStr(Replace(PivCh.SourceData, "[", vbNullString), lSource) > 0 Or InStr(PivCh.SourceData, Right$(lSource, Len(lSource) - InStrRev(lSource, "\"))) > 0 Then
                            objFSOfile.writeline "Pivot Table," & PivCh.Name & "," & sh.Name & "," & Right$(lSource, Len(lSource) - InStrRev(lSource, "\")) & "," & lSource & ",'" & PivCh.SourceData
                            FndPivLink = True
                            Exit For
                        End If
                    Next
                End If
            Next
        Case 3
            Set chr1 = Nothing
            On Error Resume Next
            Set chr1 = sh
            On Error GoTo 0
            If Not chr1 Is Nothing Then
                Application.StatusBar = "Searching charts in sheet " & sh.Name
                For Each chrSrs In chr1.SeriesCollection
                    If InStr(chrSrs.Formula, ".xls") <> 0 Then
                        For Each lSource In ActiveWorkbook.LinkSources
                            'look in open and closed workbooks
                            If InStr(Replace(chrSrs.Formula, "[", vbNullString), lSource) > 0 Or InStr(chrSrs.Formula, Right$(lSource, Len(lSource) - InStrRev(lSource, "\"))) > 0 Then
                                FndChrLink = True
                                'write to the report file
                                objFSOfile.writeline "Chart Series,Chart Sheet," & sh.Name & "," & Right$(lSource, Len(lSource) - InStrRev(lSource, "\")) & "," & lSource & ",'" & Replace(chrSrs.Formula, ",", ";")
                                Exit For
                            End If
                        Next
                    End If
                Next

                If chr1.HasTitle Then
                    chr1.Activate
                    chrTitle = CStr(ExecuteExcel4Macro("GET.FORMULA(""Title"")"))
                    If InStr(chrTitle, ".xls") <> 0 Then
                        For Each lSource In ActiveWorkbook.LinkSources
                            'look in open and closed workbooks
                            If InStr(Replace(chrTitle, "[", vbNullString), lSource) > 0 Or InStr(chrTitle, Right$(lSource, Len(lSource) - InStrRev(lSource, "\"))) > 0 Then
                                FndChrLink = True
                                'write to the report file
                                objFSOfile.writeline "Chart Title,Chart Sheet," & sh.Name & "," & Right$(lSource, Len(lSource) - InStrRev(lSource, "\")) & "," & lSource & ",'" & Replace(chrTitle, ",", ";")
                                Exit For
                            End If
                        Next
                    End If
                End If
            End If
        Case Else
        End Select
        'End If
    Next sh

    'Named ranges
    If ActiveWorkbook.Names.Count = 0 Then
    Else
        Application.StatusBar = "Searching range names"
        For nameCnt = 1 To ActiveWorkbook.Names.Count
            If InStr(ActiveWorkbook.Names(nameCnt), ".xls") <> 0 Then
                For Each lSource In ActiveWorkbook.LinkSources
                    If InStr(Replace(ActiveWorkbook.Names(nameCnt), "[", vbNullString), lSource) > 0 Or InStr(ActiveWorkbook.Names(nameCnt), Right$(lSource, Len(lSource) - InStrRev(lSource, "\"))) > 0 Then
                        FndNameLink = True
                        'write to the report file
                        objFSOfile.writeline "Range Name," & "Workbook level," & ActiveWorkbook.Names(nameCnt).Name & "," & Right$(lSource, Len(lSource) - InStrRev(lSource, "\")) & "," & lSource & ",'" & ActiveWorkbook.Names(nameCnt).RefersTo
                        Exit For
                    End If
                Next
                'Name link does not exist in "known" links
                If FndNameLink = False Then
                    FndNameLink = True
                    objFSOfile.writeline "Range Name," & "Workbook level," & ActiveWorkbook.Names(nameCnt).Name & "," & ActiveWorkbook.Names(nameCnt) & ",'" & Replace(ActiveWorkbook.Names(nameCnt).RefersTo, ",", ";")
                End If
            End If
        Next nameCnt
    End If

    'Close the report file
    objFSOfile.Close
    Set objFSO = Nothing

    'If at least one cell link was found then open report file
    If (FndChrLink = FndNameLink = FndRngLink = FndPivLink) And FndRngLink = False Then
        MsgBox "No formula links found", vbCritical
    Else
        Set wb = Workbooks.Open(ReportFile)
        With wb.Sheets(1)
            .Rows("1:2").Font.Bold = True
            .Columns("A:F").AutoFit
            .[A2].AutoFilter
        End With
    End If
    With Application
        .StatusBar = vbNullString
        .DisplayAlerts = True
    End With
    If ShProt <> vbNullString Then MsgBox "The following sheets were protected " & vbNewLine & "so these Chart titles could not be searched" & vbNewLine & ShProt, vbCritical
End Sub

这篇关于在Excel工作簿中找不到链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆