
04-20-2022, 02:33 AM
|
Novice
|
|
Join Date: Apr 2022
Posts: 3
|
|
Quote:
Originally Posted by Guessed
This code works as a starting point. There are subtle points that you may need to use to refine the location of the graphic. PinX and PinY is dependent on the LocPinX and LocPinY which may not be the middle of both the shp or the shpNew. Then you a question about sizing/relative sizing of the graphic.
Code:
Sub ProcessPage()
Dim shp As Shape, pg As Page, sPath As String, sFile As String
Dim dSpcX As Double, dSpcY As Double, shpNew As Shape
sPath = ActiveDocument.Path
For Each pg In ActiveDocument.Pages
For Each shp In pg.Shapes
If shp.CellExists("Prop.Number", 0) Then
dSpcX = shp.Cells("PinX")
dSpcY = shp.Cells("PinY")
sFile = Replace(shp.Cells("Prop.Number").Formula, """", "")
Debug.Print sPath, sFile
Set shpNew = pg.Import(sPath & sFile & ".png")
With shpNew
.Cells("PinX") = dSpcX
.Cells("PinY") = dSpcY
End With
End If
Next shp
Next pg
End Sub
|
Thank you!
I will try it
|