This document contains links that may refer to other files

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15613
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

This document contains links that may refer to other files

Post by ChrisGreaves »

How does one maintain program control in a situation like this?

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
Thanks
Chris
You do not have the required permissions to view the files attached to this post.
Last edited by ChrisGreaves on 30 Dec 2020, 20:08, edited 1 time in total.
There's nothing heavier than an empty water bottle

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15613
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: This document contains links that may refer to other files

Post by ChrisGreaves »

ChrisGreaves wrote:
30 Dec 2020, 20:06
I brought up Word2003 Help files on Links and (Next Post!) attach a summary ("Links.doc").
Limit of three attachments!
Chris
You do not have the required permissions to view the files attached to this post.
There's nothing heavier than an empty water bottle

User avatar
HansV
Administrator
Posts: 78463
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: This document contains links that may refer to other files

Post by HansV »

To suppress the dialog, you must use

Code: Select all

    Options.UpdateLinksAtOpen = False
Best wishes,
Hans

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15613
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: This document contains links that may refer to other files

Post by ChrisGreaves »

HansV wrote:
30 Dec 2020, 20:20
To suppress the dialog, you must use

Code: Select all

Options.UpdateLinksAtOpen = False
GAAAAAAAH! :burnup: Do I get half-points for being so close to being right?

I shall have to wrap my head around this.


In terms of my 10,000 document job, while I had UpdateLinksAtOpen = False the VBA job stopped and forced a user/operator manual intervention in real-time.

When I have UpdateLinksAtOpen = True the VBA job continues but before my VBA code can determine whether or not to update links, Word2003 has gone ahead and updated them anyway, automatically, as part of the Documents.Open method.

Have I go that right?

In other words, in a large 10,000 file job, there is no way to decide by program code whether or not to update links on a file-by-file basis.

Thanks Hans.
There's nothing heavier than an empty water bottle