#1
|
|||
|
|||
Searching WORD files for specific link ???
I have a bunch of WORD-files in some subfolders.
In each file can be links inserted - maybe more, maybe no links at all. When links are inserted it can be to the internet or to some local files. How can I by VBA find out if a specific link are used or not in these files ? In fact I'm looking for a function something like this: IsThisLinkUsedIn(<link>,<top folder>) and the function should just returning TRUE if the link IS used in ONE file in the subfolders or FALSE if the link is NOT used at all in any file in the subfolders. I can do the treversing of the files (I think), but I'm not aware of how to search each file for a link via VBA - how can I do that ? |
#2
|
||||
|
||||
You can check the documents using a function similar to
Code:
Function IsThisLinkUsedIn(strLink As String, oDoc As Document) As Boolean Dim oLink As Hyperlink For Each oLink In oDoc.Hyperlinks If oLink.Address = strLink Then IsThisLinkUsedIn = True Exit For End If Next oLink Set oLink = Nothing End Function Code:
Sub Macro1() MsgBox IsThisLinkUsedIn("https://www.gmayor.com/Word_pages.htm", ActiveDocument) End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
Tags |
function, links |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Saving new word documents to specific files | maxbeedie | Word | 1 | 11-15-2016 04:04 AM |
Batch create word files with link to changing excel | hannes.ledegen | Mail Merge | 8 | 04-07-2016 01:22 AM |
Searching Multiple PowerPoint & Word Files | BobbyAre | PowerPoint | 14 | 08-12-2012 06:52 AM |
searching for text in multiple excel files | roytom | Excel | 2 | 07-30-2012 01:57 PM |
searching for Link in my Outlook Msg. body... | JeffBPaarsa | Outlook | 0 | 03-30-2012 05:02 PM |