![]() |
#1
|
|||
|
|||
![]()
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? |
#2
|
|||
|
|||
![]()
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. |
#3
|
||||
|
||||
![]()
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 |
#4
|
|||
|
|||
![]()
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.
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
enso | Word VBA | 4 | 02-25-2021 05:19 PM |
![]() |
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 |