drom
Well-known Member
- Joined
- Mar 20, 2005
- Messages
- 543
- Office Version
- 2021
- 2019
- 2016
- 2013
- 2011
- 2010
- 2007
Hi and Thanks in advance!
I have a word template
so when I use:
So How can I refer to my selected Ishape to Add a image located in my PC ??
My Idea is to replace this kind of shape (this iShape) with a new one using Excel's VBA, I mean from Excel
I know how insert a image in word but not how to replace the iShaoe using his size Top, Left, width and Height
I have a word template
- I have to populate a few word marks from excel using vba (no problem)
so when I use:
VBA Code:
Dim objWord As Object: Set objWord = CreateObject("Word.Application")
objWord.Visible = True
Dim wFxFullName as String: wFxFullName=range("A4") 'This file always Exists
Dim wImgFullName as String: wImgFullName=range("A5") 'This Image file always Exists
Dim objDoc As Object: Set objDoc = objWord.Documents.Add(Template:=wFxFullName, NewTemplate:=False, DocumentType:=0)
Debug.Print objDoc.InlineShapes.Count 'always Shows 1
Dim iShape As InlineShape: Set iShape =objDoc.InlineShapes(1)
iShape.LockAspectRatio = msoFalse
iShape.select
Debug.Print iShape.Height, iShape.Width 'Goes OK
Debug.Print iShape.Top, iShape.Left 'Does not show anything, goes wrong
'MY MINE PROBLEN
'This line goes WRONG:
Selection.AddPicture (wImgFullName)
So How can I refer to my selected Ishape to Add a image located in my PC ??
My Idea is to replace this kind of shape (this iShape) with a new one using Excel's VBA, I mean from Excel
I know how insert a image in word but not how to replace the iShaoe using his size Top, Left, width and Height