+ Reply to Thread
Results 1 to 7 of 7

Missing PDF filles hyperlinked to Excel

Hybrid View

  1. #1
    Registered User
    Join Date
    10-23-2018
    Location
    Qatar
    MS-Off Ver
    Microsoft Office Standard 2016
    Posts
    4

    Post Missing PDF filles hyperlinked to Excel

    Dear All,

    I have a log of inspection files (pdf) hyper linked with Excel log sheet, the problem is I have linked hundreds of such pdf files within single excel sheet. some of pdf files are suppose to be added in future, however its files names and location were already updated in the list.
    Need to code to highlight such missing pdf links, so that it can be sort out and updated.

    Looking forwards suggestion and solution to resolve.

    Thanks and Regards

    Ilyas
    Last edited by ilyas87; 11-01-2018 at 09:07 AM.

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,913

    Re: Missing PDF filles hyperlinked to Excel

    Use Dir() function on hyperlink.address, assuming hyperlink address is absolute reference (and not relative path to pdf).

    Ex:
    Sub Demo()
    Dim hl As Hyperlink
    For Each hl In ThisWorkbook.Sheets("Sheet1").Hyperlinks
        If Dir(hl.Address) = vbNullString Then
            hl.Delete 'Or some other operation
        Else
            'Do something?
        End If
    Next
    End Sub
    But you'll need to adjust the code to suite your need as I'm not sure how your workbook is set up and what exactly should be done by the code.

    Note: Above also assumes hyperlinks are not built using HYPERLINK() function.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Registered User
    Join Date
    10-23-2018
    Location
    Qatar
    MS-Off Ver
    Microsoft Office Standard 2016
    Posts
    4

    Re: Missing PDF filles hyperlinked to Excel

    Thanks for the reply,

    hyperlink are relative path and hyperlink created using hyperlink function. Kindly find sample excel sheet for your reference and pdf file names for your reference.

    Thanks and regards

    Ilyas
    Attached Files Attached Files

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,913

    Re: Missing PDF filles hyperlinked to Excel

    Hmm? You are using absolute path. Not relative path in relation to workbook itself.

    Relative path would be something like ..\Folder\File.pdf. You have absolute path using "drive letter:\Path\File.pdf".

    Since, HYPERLINK formula cannot be accessed via Hyperlink object. You must read the formula text and manipulate it.

    Ex: With your sample.
    Sub Demo()
    Dim cel As Range
    For Each cel In Range("E2:E" & Cells(Rows.Count, "E").End(xlUp).Row).Cells
        x = Split(cel.Formula, """")
        y = x(1) & x(3) & cel.Value & x(5)
        If Dir(y) = vbNullString Then
            'Do something when linked file does not exist
        Else
            'Do nothing. Or something when file exist
        End If
    Next
    End Sub

  5. #5
    Registered User
    Join Date
    10-23-2018
    Location
    Qatar
    MS-Off Ver
    Microsoft Office Standard 2016
    Posts
    4

    Re: Missing PDF filles hyperlinked to Excel

    Thanks for the reply.

    But I got run time error:9 Subscript Out of range.
    Kindly help to resolve the issue.

    Thanks
    Attached Images Attached Images

  6. #6
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,913

    Re: Missing PDF filles hyperlinked to Excel

    So you have pattern that's different from what you had in your sample.

    Split() function splits string based on double quote. Use that logic or some other text manipulation as needed.
    If you are unable to modify. Then upload sample that's more representative of your setup.

  7. #7
    Registered User
    Join Date
    10-23-2018
    Location
    Qatar
    MS-Off Ver
    Microsoft Office Standard 2016
    Posts
    4
    Thank you so much for support. It's work great.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 06-26-2017, 03:13 PM
  2. Excel Macro to find missing dates and insert missing date as blank row
    By JevaMarie in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-26-2013, 11:08 AM
  3. Save or Email Hyperlinked File within Excel
    By cixelsyd in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-30-2010, 12:11 PM
  4. Date Last Modified of Hyperlinked Documents + Collaboration of Hyperlinked Documents
    By mr butter in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-15-2010, 05:35 AM
  5. Replies: 0
    Last Post: 02-28-2006, 12:40 PM
  6. Replies: 1
    Last Post: 10-07-2005, 05:57 AM
  7. List filles from a directory
    By raraujo in forum Excel General
    Replies: 0
    Last Post: 05-16-2005, 10:14 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1