How to Insert Photo into MS Word Bookmark
In this How To, I will demonstrate how to insert a Photo/Picture from a specific file location or from file dialog into a bookmark location of MS Word. Please follow the steps below:
Step 1. Create a New Word Document
• Open new MS word document file and save as my Photo in the same folder of Access file
• Type a description or location of your photo
• Move cursor the location where you want to create a bookmark
Step 2. Insert Bookmark
• Select on Insert Menu bar
• Click Bookmark icon to open a bookmark window
• Type a bookmark name ( for example: Photo)
• Click Add
Step 3. Create Form in Access
• Create a new blank form in your Access file (More Information of how to create form here)
• Add a button and name it as Insert Photo
• Click OK to close this window
Step 4. Insert Event Procedure
• Open form under the form design view
• Double-Click on the Insert Photo button to open a Property Sheet
• Select on Event tab of Property Sheet
• Select [Event Procedure] under On Click row
• Click on three dot (…) at the end of On Click Event Procedure
Step 5. Insert VBA code
- Open Word from same folder
We need to insert the VBA code to open file my Photo of MS Word that we already created on Step 1. This Word file is located in the same folder of the Access file. We also want to insert a picture file from our specific location (for example: “c:\dropbox\cat.jpg”) into the location of our bookmark (“Photo”) on word file.
- Open Word from Specific Location
If we have MS Word file in different folder from Access file then we need to set the file path as (example):
Path = “C:\Users\thong\Downloads\my Photo.docx”
After click the Insert Photo button, it will open file my Photo of MS Word and display a photo on the bookmark location below a statement Insert Photo here: as we set on Step 2.
- Insert Photo from a FileDialog
Some time you may want to insert a specific image file on your own. We can use a FileDialog method to select the photo from the FileDialog winow (More information at : http://www.iaccessworld.com/function-selectfile-from-filedialog/)
• Insert VBA code below at the beginning of your code below assign the picture into a bookmark in MS Word.
After click the Insert Photo button, it will open file my Photo of MS Word and display a photo that is selected from the FileDialog above on the bookmark location below a statement Insert Photo here: as we set on Step 2.