OaklandJim
Well-known Member
- Joined
- Nov 29, 2018
- Messages
- 855
- Office Version
- 365
- Platform
- Windows
I have code below. It copies some cells in one worksheet (Inputs), then pastes them as a picture into another worksheet (Report). It is transparent after the paste but I want it to not be transparent and I want it to have fill of white. I tried approaches that I could think of but get "Object does not support this property or method" error. What basic concept/syntax am I missing?
VBA Code:
Sub PictureOfTopToReport()
Dim wsInput As Worksheet
Dim wsReport As Worksheet
Dim picTop As Picture
Dim sPicTopName As String
Set wsInput = Worksheets("Inputs")
Set wsReport = Worksheets("Report")
sPicTopName = "TopPart"
wsInput.Range("A1:AK19").Copy
With wsReport
.Activate
.Range("A1").Activate
Set picTop = .Pictures.Paste
picTop.Name = sPicTopName
End With
Application.CutCopyMode = False
' Code below causes "Object does not support this property or method" errors
With picTop
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorBackground1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0
.Transparency = 0
.Solid
End With
With wsReport.Shapes(picTop.Name)
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorBackground1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0
.Transparency = 0
.Solid
End With
End Sub