How to include a picture from a hyperlink (to Sharepoint doclib) in Word?

Brass Contributor

I want to create a Worddoc where a picture changes automatically once the pic in the Sharepoint doclib is replaced. (the Worddoc and the SP have accessrights for the same group of people on the same tenant on MS365 Business Standard)
I just tried the Insert> QuickParts >Field > Links & Refernces > Include Picture. I get this error.

SaraBo_0-1694424520951.png

Even when I use the URL of a pic on a (public) website it returns the same error. While in both cases the links on themselves work fine in a browser. So I guess there is something other than the link not working. Have you got any idea on how to fix this issue? And once it works, how to preserve the sizing on updating (if anything should be done for that)?

 



7 Replies

Hi @SaraBo,

To insert a picture from a SharePoint document library hyperlink into a Word document and ensure it automatically updates when the source image changes, follow these steps:

  1. Get the SharePoint Document Library URL:

    • Make sure the image you want is in a SharePoint document library.
    • Copy the direct URL of the image file.
  2. Insert an Image Placeholder:

    • In your Word document, place your cursor where you want the image.
    • Go to the "Insert" tab and choose "Quick Parts" > "Field."
  3. Select the IncludePicture Field:

    • In the Field dialog box, look for "IncludePicture" in the list of field names.
  4. Set the Field Codes:

    • You'll see a placeholder in the "Field codes" box. Replace it with this code:
     
    INCLUDEPICTURE "URL"

    Replace "URL" with the direct link to your image in the SharePoint library.

  5. Preserve Image Sizing:

    • If you want to maintain the image's size, you can add the \d switch followed by the desired dimensions. For example, to set it to 300x200 twips, use:
     
    INCLUDEPICTURE "URL" \d 300x200

    Replace "URL" with your SharePoint image link.

  6. Update the Field:

    • To display the image, right-click on the field code and select "Update Field."
    • Your image will appear in the Word document.
  7. Save and Share:

    • Save the Word document where your team can access it, like SharePoint or OneDrive.

Now, when you replace the source image in the SharePoint library, you can update the image in your Word document by right-clicking on it and choosing "Update Field."


Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.


If the post was useful in other ways, please consider giving it Like.


Kindest regards,


Leon Pavesic

 

Hi Leon, thx for your quick and elaborate response!
Your suggestion of toggling the fieldcodes made the program take a split second, asking me if I was sure to accept external links... to then return the same issue. Even with a link to this public image it doesn't work: https://i0.wp.com/kanli.be/wp-content/uploads/2023/09/MS365snelkoppeling-toevoegen.png
In my version of Word there is no "Update field" button though either.


@SaraBo To update fields, you need to select them (or use CTRL+a to select everything in the document and then press F9 (or Fn+F9 on some keyboards)

Thx! We're getting closer!
Now the link to the online pic (website) works, but the link to the picture in Sharepoint doens't work.
- I am sure that with regards to the access in Sharepoint I have access as an owner
- could it be that I need to fetch the link to the pic in another way than through the ellipsis>Copy Link? I know that in Excel you sometimes need to alter things manually in a link... could there be a similar hick-up here?
Thx in advance

@SaraBo To provide access to files (pictures) on OneDrive, they need to be "shared"  As I do not use Sharepoint, I do not know anything about it, but it also may require that the file be shared.

Thx for your reply. How I have things set up in SP (Sharepoint) the sharing part is correctly setup. As in as I am able to access the file in SP directly, the Word app using the same link should also have access. Right now in Excel it is possible to do a similar thing with the =IMAGE() function. So thanks to your reply I thought of trying the same there.
In Excel I get the #BLOCKED error and some more info on Active Content. In the infopage that is linked in the Excel error message it says Word has the same (unfortunetly the screenshots in this page haven't been changed recently it seems: https://support.microsoft.com/en-us/office/active-content-types-in-your-files-b7ff2e8a-4055-47d4-8c7...). I will have to check where to change these settings. I'll keep you posted if I find a solution!
It's getting more weird by the minute...
- So it seems any hyperlink is considered a Linked Data Type/Active Content and thus a danger (in Excel, in Word it seems to see the safety)... whilst the link is coming from the same tenant?!? Hoping that Copilot will finally be able to make the whole of MS365 recognize same tenant links as secure...
- I found the Trust Center through the Info tab and refreshed the links from there (in Word, in Excel the links are stored elsewhere, not even in the queries and connections but only in the function). Why not add some more consistency here too?

Conclusion: whatever I do there's nothing changing. But given the #BLOCKED error in Excel I'd suppose there is a security-setting involved blocking this productivity-enhancer. Would it be worth trying to find out which setting it is, knowing that we'll probably be getting a no-go afterwards from IT dept...