Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 04-20-2022, 02:33 AM
JanH JanH is offline Insert a Picture by ShapeData Windows 10 Insert a Picture by ShapeData Office 2019
Novice
Insert a Picture by ShapeData
 
Join Date: Apr 2022
Posts: 3
JanH is on a distinguished road
Thumbs up

Quote:
Originally Posted by Guessed View Post
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
Reply With Quote
 

Tags
picture, shapedata

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert a Picture by ShapeData Using IncludePicture and MailMerge to insert picture that is taken from a a picture lookup in Excel nic-nax Mail Merge 4 05-14-2019 10:34 PM
Insert a Picture by ShapeData Picture content control -> insert picture -> empty? Jaymond Flurrie Word 3 07-13-2016 07:00 AM
Insert a Picture by ShapeData How do I insert pictures directly into picture boxes by clicking the box instead of using INSERT>PIC Bree Word 1 06-24-2016 10:32 PM
Insert a Picture by ShapeData "Insert Picture\Link to File..." embeds picture sinz54 Drawing and Graphics 1 09-29-2013 06:31 PM
Insert a Picture by ShapeData Can I insert a picture into a picture ? alexcalgary Drawing and Graphics 2 10-16-2010 03:29 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:39 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