Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Vancouver, Br. Columbia, Canada
    Posts
    632
    Thanks
    0
    Thanked 0 Times in 0 Posts
    When an Excel file is opened and it contains an invalid link to another workbook, Excel responds with a dialog box. Is it possible to trap the error, run some code to fix the invalid link, and suppress the dialog box? If so, how...?

    I am just looking for advice how to detect and respond to the invalid link; I will muddle my way thru the other stuff.
    --------------------------------------------------
    Jack MacDonald
    Vancouver, Canada

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    You can use the Workbook_Open event in the ThisWorkbook module:

    Code:
    Private Sub Workbook_Open()
      Dim i As Integer
      Dim arrLinks
      Application.DisplayAlerts = False
      
      arrLinks = Me.LinkSources(xlExcelLinks)
      For i = 1 To UBound(arrLinks)
    	If Dir(arrLinks(i)) = "" Then
    	  ' File has not been found
    	  MsgBox arrLinks(i) & " can't be found", vbExclamation
    	End If
      Next i
      Application.DisplayAlerts = True
    End Sub

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Vancouver, Br. Columbia, Canada
    Posts
    632
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks Hans. Worked 100%
    --------------------------------------------------
    Jack MacDonald
    Vancouver, Canada

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •