Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-02-2022, 08:25 AM
PhilS PhilS is offline Convert Folder paths to Hyperlinks Windows 7 64bit Convert Folder paths to Hyperlinks Office 2007
Novice
Convert Folder paths to Hyperlinks
 
Join Date: Jan 2022
Posts: 1
PhilS is on a distinguished road
Default Convert Folder paths to Hyperlinks

I have created a list of 1,500 folder paths, e.g. F:\Curr\docs
How can I convert all of these into hyperlinks so that I can jump to that folder in Windows explorer?
Reply With Quote
  #2  
Old 01-03-2022, 12:38 PM
kilroyscarnival kilroyscarnival is offline Convert Folder paths to Hyperlinks Windows 10 Convert Folder paths to Hyperlinks Office 2019
Expert
 
Join Date: May 2019
Posts: 345
kilroyscarnival is just really nicekilroyscarnival is just really nicekilroyscarnival is just really nicekilroyscarnival is just really nice
Default

I'm presuming you have all those in Word. But to me, the task is most easily completed in Excel, and I'm going to hope you have that as well.

Whether your list is in a Word Table or just a list with paragraph or line breaks after them, it should be as simple as copying your list to Column A of a new Excel worksheet.

So then, in Column B, you'd type "=HYPERLINK(A1)" without the quotation marks of course. When you hit enter, you should get a working hyperlink for the path in Cell A1.

Then fill-down the B column for a different hyperlink in each.

Then, presumably you could just copy the items in the B column and paste back into Word.
Reply With Quote
  #3  
Old 01-03-2022, 10:45 PM
gmayor's Avatar
gmayor gmayor is offline Convert Folder paths to Hyperlinks Windows 10 Convert Folder paths to Hyperlinks Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,105
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

If each item in the list is a paragraph then select the list and run the following Word macro. This will hyperlink those paragraphs that have valid folder paths. Invalid paths are coloured red.

Code:
Sub Macro1()
'Graham Mayor - https://www.gmayor.com - Last updated - 04 Jan 2022
Dim sLink As String
Dim oLink As Hyperlink
Dim oPara As Paragraph
Dim oRng As Range
Dim FSO As Object
    Set FSO = CreateObject("Scripting.FileSystemObject")
    For Each oPara In Selection.Paragraphs
        Set oRng = oPara.Range
        oRng.End = oRng.End - 1
        If FSO.FolderExists(oRng.Text) Then
            Set oLink = Selection.Hyperlinks.Add(Anchor:=oRng, _
                                                      Address:=oRng.Text, _
                                                      ScreenTip:="Click to select the linked folder", _
                                                      TextToDisplay:=oRng.Text)
        Else
            oRng.Font.ColorIndex = wdRed
        End If
    Next oPara
lbl_Exit:
    Set oLink = Nothing
    Set oRng = Nothing
    Set oPara = Nothing
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #4  
Old 01-04-2022, 10:18 AM
kilroyscarnival kilroyscarnival is offline Convert Folder paths to Hyperlinks Windows 10 Convert Folder paths to Hyperlinks Office 2019
Expert
 
Join Date: May 2019
Posts: 345
kilroyscarnival is just really nicekilroyscarnival is just really nicekilroyscarnival is just really nicekilroyscarnival is just really nice
Default

Quote:
Originally Posted by gmayor View Post
If each item in the list is a paragraph then select the list and run the following Word macro. This will hyperlink those paragraphs that have valid folder paths. Invalid paths are coloured red.
Nice solution. I wasn't sure whether it would work like that. I tried it on a multi-page list, and it converted the ones I had selected.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert Folder paths to Hyperlinks Convert many hyperlinks to the actual url, document-wide, not individually enso Word VBA 4 02-25-2021 05:19 PM
Convert Folder paths to Hyperlinks Convert html links into embedded hyperlinks njcloud Mail Merge 23 02-04-2020 02:00 PM
Network Paths not formatting as hyperlinks kneghx Outlook 0 10-11-2018 11:10 AM
Convert Hyperlinks to ahref dan88 Word VBA 2 05-09-2016 06:19 PM
Macro to change/convert/delete txt files in folder+subfolders NoS Word VBA 4 03-03-2016 12:10 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:06 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft