So I am currently working with a macro that takes multiple ranges between different sheets and uploads them to a specific shared location:
In order to efficiently utilize these images, I need the width of both images to not exceed 1920 pixels (In order to display correctly on a 1080p TV).
Is it possible to resize these images before they are uploaded?
VBA Code:
Dim objChrt As Chart
Dim rngImage As Range
Dim strFile As String
On Error GoTo ErrExit
With Sheets("Sheet1")
Set rngImage = .Range("C1:R99")
rngImage.CopyPicture Appearance:=xlScreen, Format:=xlBitmap
strFile = "Location1.PNG"
Set objChrt = .ChartObjects.Add(rngImage.Left, rngImage.Top, rngImage.Width, rngImage.Height).Chart
With objChrt
.Parent.Activate
.ChartArea.Format.Line.Visible = msoFalse
.Paste
.Export strFile
.Parent.Delete
End With
With Sheets("Sheet2")
Set rngImage = .Range("B8:L29")
rngImage.CopyPicture Appearance:=xlScreen, Format:=xlBitmap
strFile = "Location2.PNG"
Set objChrt = .ChartObjects.Add(rngImage.Left, rngImage.Top, rngImage.Width, rngImage.Height).Chart
With objChrt
.Parent.Activate
.ChartArea.Format.Line.Visible = msoFalse
.Paste
.Export strFile
.Parent.Delete
End With
End With
End With
ErrExit:
Set objChrt = Nothing
Set rngImage = Nothing
End Sub
In order to efficiently utilize these images, I need the width of both images to not exceed 1920 pixels (In order to display correctly on a 1080p TV).
Is it possible to resize these images before they are uploaded?