0

I am currently building a word-template for a report. In this report are used red separators as part of the design. The separators are basically just images of red, curved lines.

Instead of copy and pasting these separators when needing them, is there a way to store the image somewhere in the document, allowing it to be inserted with just the click of a button in the ribbon? My first bet would be to create a macro somehow that would insert the image, however that would require the image to be stored in a very specific path on the computer.

As this document is gonna be used by lots of people without this image stored on their harddrive, i need another way.

Thanks so much in advance!

  • You could store the image as BASE64-String in your macro, see something similar for excel: https://stackoverflow.com/questions/39126617/inserting-an-image-into-a-sheet-using-base64-in-vba/39222080 – Turo Jan 16 '21 at 16:25

1 Answers1

0

You could insert the images into bookmarks created via SET fields in, say, the document header, then reproduce them elsewhere in the document via cross-references. The images in the SET fields wouldn't themselves be visible.

For example:

{SET Image1 "Actual image1"}

to create the bookmark and

{REF Image1}

to display the image.

No code required.

By default, the size of the pictures when inserted via a cross-reference will be the same size as they are in the SET field, plus they'll be formatted as in-line with text.

If they're meant to be full-width images, simply make sure to insert the cross-reference into a new paragraph with 0 indenting.

To constrain the images' displayed size to something smaller than the width they're inserted into the SET field at, insert them into a table whose row height and/or column width has the required fixed dimension.

To apply text-wrapping, insert the cross-references into a table and format the table's wrapping as 'around'.

Note: The field brace pairs (i.e. '{ }') for the above example are all created in the document itself, via Ctrl-F9 (Cmd-F9 on a Mac or, if you’re using a laptop, you might need to use Ctrl-Fn-F9); you can't simply type them or copy & paste them from this message.

macropod
  • 12,757
  • 2
  • 9
  • 21
  • Hi! Thanks for your response. That sounds like it could work, but I'm a bit unsure on how to approach it. How will it store my image (from a path?) – Alexander Hansen Jan 19 '21 at 10:41
  • The image will be stored in the SET field, *between* the double quotes, where my answer has the 'Actual Image1' text. Pressing Alt-F9 toggles the field code display on/off. With it toggled 'on' you'll be able to see and edit the images, if needs be. – macropod Jan 19 '21 at 11:46
  • Awesome, it works now! However, is there a way to have the picture span the width of the page? Right now the picture is in line with the tekst and the margin. – Alexander Hansen Jan 19 '21 at 13:12
  • Thank you, putting it in a table and then formatting the table works great! – Alexander Hansen Jan 19 '21 at 23:14