Rock_Doctor
New Member
- Joined
- Mar 10, 2017
- Messages
- 14
So I have an excel sheet with formatted shapes with which I use fill to populate the shapes with pictures for a report.
I have the basic macro code sorted to do this with a button but when I try to substitute the file path with a cell on the spreadsheet containing the file path it results in a fill object fail.
Here is the code that works:
After trying to insert the cell value:
I have tried adding quotations in the cell value as well thinking that was the issue.
Any help is much appreciated!
I have the basic macro code sorted to do this with a button but when I try to substitute the file path with a cell on the spreadsheet containing the file path it results in a fill object fail.
Here is the code that works:
Code:
Sub Macro1()'
' Macro1 Macro
'
ActiveSheet.Shapes.Range(Array("Rectangle 10")).Select
With Selection.ShapeRange.Fill
.Visible = msoTrue
.UserPicture _
"Filepath"
.TextureTile = msoFalse
.RotateWithObject = msoTrue
End With
End Sub
After trying to insert the cell value:
Code:
Sub Macro1()'
' Macro1 Macro
'
PictureFileName = Range("V11").Value
ActiveSheet.Shapes.Range(Array("Rectangle 10")).Select
With Selection.ShapeRange.Fill
.Visible = msoTrue
.UserPicture _
PictureFileName
.TextureTile = msoFalse
.RotateWithObject = msoTrue
End With
End Sub
I have tried adding quotations in the cell value as well thinking that was the issue.
Any help is much appreciated!