Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 08-17-2020, 06:50 AM
Boris_R Boris_R is offline Filling data with XML Windows Vista Filling data with XML Office 2010 32bit
Novice
 
Join Date: Oct 2015
Posts: 6
Boris_R is on a distinguished road
Default

Quote:
Originally Posted by Guessed View Post
Note that the 'image' file type is actually a string. You won't be able to include a PNG image in a text only format which is necessary for xml.
Here is some sample code to insert an image using XML mapping.
After running the code, a "Red Square" will appear in the document
Code:
Sub Add_Picture()
Dim oCC As Word.ContentControl
Dim oCustomPart As Office.CustomXMLPart
    Set oCC = ActiveDocument.ContentControls.Add(wdContentControlPicture)
    Set oCustomPart = ActiveDocument.CustomXMLParts.Add("<ccMap><ccData>iVBORw0KGgoAAAANSUhEUgAAADAAAAAmCAIAAAAN749WAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAScwAAEnMBjCK5BwAAAHNJREFUWEftmLEJwDAMBJU9Umb/zbKDE1BjjLkukeCMum+e86nRcZ9XlHpPoVITpdq832UhMKQPoW82bxVmS8hC6ZaEZhV0iFZDQhIiApTrkISIAOU6JCEiQLkOSYgIUK5DEiIClHd26K8zTZ/rh4Ty2DAAkMHKNHSz0cwAAAAASUVORK5CYII=</ccData></ccMap>")
    With oCC
      .Title = "Picture"
      .XMLMapping.SetMapping "/ccMap/ccData[1]"
    End With
Exit Sub
End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Filling in cells based on 2 other cells data Dawindle Excel 4 11-10-2018 07:40 AM
filling in blank cells with data from cell above RayK Excel 1 01-12-2017 04:14 PM
Wierd... "cell" started auto filling with data from other cells I double click on. How stop it?! KerryOn Excel 2 08-10-2015 08:41 PM
Filling data with XML matching data from one work sheet to another, then auto filling missing cell information timomaha Excel 1 09-12-2014 07:51 AM
Filling data with XML New to Excel - Filling out data The Accountant Excel 2 12-16-2013 12:32 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:14 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft