I am looping through a large collection of documents, scraping some of them for text and/or program code. The attached document "BakedBeansGeneration.doc" raises a pop-up box when my program opens it "This document contains links that may refer to other files …".
I brought up Word2003 Help files on Links and (Next Post!) attach a summary ("Links.doc").
I think that I do not want to "BreakLink" or to "UpdateLinksAtOpen", but the pop-up box is not a trappable run-time error, so it seems to me that I ***must*** "UpdateLinksAtOpen" just to let my little test program maintain control. (I will not sit up all night waiting for a pop-up box so that I can click OK)
If only I could open the file I would like to obtain/play with the "LinkToContent" business, so that I can see just what is being linked to. For example, if the link target is in the same folder as the document, then I might be interested in updating the link, otherwise not.
Using "Options.UpdateLinksAtOpen = True" does not bypass the pop-up box.
Using "BreakLink" and " LinkToContent" can be used only after the document is opened.
Years ago (Win95) I ran an Excel/VBA in parallel and checked to see if the log file had changed in the past minute, and if it had not, rebooted the desktop computer and had the Word/VBA avoid the untreated file and resume processing at the next file. I would rather not dig out that code and wire it up.
Code: Select all
Sub test()
Options.UpdateLinksAtOpen = True ' This does not suppress the pop-up box
Dim strFullname As String
strFullname = "T:\Blotter\20201230\BakedBeansGeneration.doc"
Dim doc As Document
Set doc = Documents.Open(strFullname)
End Sub
Chris