The question pretty much explains every thing. I want to know if there is a way to change image in a picture content control from an image in another picture content control using vba.
Thanks
The question pretty much explains every thing. I want to know if there is a way to change image in a picture content control from an image in another picture content control using vba.
Thanks
This appears to work. It assumes that the content controls are of the Picture type (which is why you've probably been having difficulties switching the contents). One of the pictures is saved to the Clipboard, while the other is put at the end of the document. The one from the clipboard is pasted into the other control, then that at the end of the document is cut and pasted into the first control.
Dim cc1 As word.ContentControl, cc2 As word.ContentControl
Dim ils1 As word.InlineShape, ils2 As word.InlineShape
Dim doc As word.Document, rngTemp As word.Range
Set doc = ActiveDocument
Set rngTemp = doc.content
rngTemp.Collapse wdCollapseEnd
Set cc1 = doc.Contentcontrols(1)
Set cc2 = doc.Contentcontrols(2)
Set ils1 = cc1.Range.InlineShapes(1)
Set ils2 = cc2.Range.InlineShapes(1)
ils1.Range.Copy
rngTemp.FormattedText = ils2.Range.FormattedText
ils2.Range.Paste
rngTemp.Cut
ils1.Range.Paste