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 am having some probles when trying to fill a shape with a picture located in my folder
The Picture exist
Actually I have tried with many different pictures and extensions
When I use the Macro recorded, I can't get the code from there...
I do not see in VBA anything apart of, anything rather than:
Although I get the image on my shape, Although the shape is filled with the selected picture from my folder
I have tried:
Insert Image to shape existing previous question
But for me does not work despite changing:
ActiveSheet.Shapes.Range(Array("Diagram XX")).Select
ps: I know I can insert a image easily using:
BUT i am trying to learn how to fill a SmartArtLayouts with a existing picture located in a string
I am having some probles when trying to fill a shape with a picture located in my folder
The Picture exist
Actually I have tried with many different pictures and extensions
VBA Code:
Sub FillShapeWithPicture()
On Error Resume Next: Application.ScreenUpdating = False
Dim ogSALayout As SmartArtLayout: Set ogSALayout = Application.SmartArtLayouts(1) 'I Do no care any if I have to put 5, 8, or...
Dim ogShp As Object: Set ogShp = ActiveSheet.Shapes.AddSmartArt(ogSALayout)
Dim QNode As SmartArtNode
Dim QNodes As SmartArtNodes: Set QNodes = ogShp.SmartArt.AllNodes
Dim XX As Integer: XX = QNodes.Count
Dim X As Integer
Dim wPictureFullName As String: wPictureFullName = "C:\Users\WINDOWS 7\aaaaPendingJOBS\0000_FOTOS\AFRICA.jpeg"
For X = XX To 2 Step -1
QNodes(X).Delete
Next X
'With ActiveSheet.Shapes("Diagram 27").Fill 'Using this Does not work either
'With ogShp.Fill ' ActiveSheet.Shapes("Diagram 24").Fill 'Using this Does not work either
ogShp.Select
'UNTIL HERE WORKS FINE
'From Now on NO
With Selection.ShapeRange.Fill
.Visible = msoTrue
.UserPicture wPictureFullName 'CStr(wPictureFullName) ' Using any of this Does not work either
.TextureTile = msoFalse
.RotateWithObject = msoTrue
End With
End Sub
When I use the Macro recorded, I can't get the code from there...
I do not see in VBA anything apart of, anything rather than:
VBA Code:
Sub b()
' b Macro
ActiveSheet.Shapes.Range(Array("Diagram 30")).Select
End Sub
I have tried:
Insert Image to shape existing previous question
But for me does not work despite changing:
ActiveSheet.Shapes.Range(Array("Diagram XX")).Select
ps: I know I can insert a image easily using:
VBA Code:
Sub InsertPhoto()
Dim wPictureFullName As String: wPictureFullName = "C:\Users\WINDOWS 7\aaaaPendingJOBS\0000_FOTOS\AFRICA.jpeg"
ActiveSheet.Pictures.Insert(wPictureFullName).Select
Dim ShpPhotoNew As Object: Set ShpPhotoNew = Selection
'And change the location and...
end sub
BUT i am trying to learn how to fill a SmartArtLayouts with a existing picture located in a string