#1
|
|||
|
|||
Insert a Picture by ShapeData
Hello,
is it possible to insert a picture in the shape by ShapeData informations? scenario: 1) Shape have the ShapeData: "Number" 2) Value of "Number" is "12345" 3) Visio look up "12345" in the folder C:\Users\Pictures 4) Visio inserts Picture with the Name "12345" in the middle of the shape |
#2
|
||||
|
||||
Via a VBA macro - Yes.
Is this supposed to run on a particular shape or across all the shapes on the page/document?
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#3
|
|||
|
|||
Quote:
Hi, thank you for the quick response. It is supposed to run on all shapes across the page. There are 150+ identical shapes with different "Number" values on the page. Could you please make an example for the VBA macro? |
#4
|
||||
|
||||
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
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#5
|
|||
|
|||
Quote:
Thank you! I will try it |
Tags |
picture, shapedata |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
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 |
Picture content control -> insert picture -> empty? | Jaymond Flurrie | Word | 3 | 07-13-2016 07:00 AM |
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 Picture\Link to File..." embeds picture | sinz54 | Drawing and Graphics | 1 | 09-29-2013 06:31 PM |
Can I insert a picture into a picture ? | alexcalgary | Drawing and Graphics | 2 | 10-16-2010 03:29 PM |