TkdKidSnake
Active Member
- Joined
- Nov 27, 2012
- Messages
- 255
- Office Version
- 365
- Platform
- Windows
Hi all,
I am exporting a range of cells as a PNG however, when I look at the result I am getting a white border at the bottom and to the right (there isn't any white there) - Any ideas why and how to resolve this as it would save me having to manually edit each time.
The code I have is:
This is what I am seeing as the output:
Any help you can provide would be greatly appreciated.
Thanks in advance
I am exporting a range of cells as a PNG however, when I look at the result I am getting a white border at the bottom and to the right (there isn't any white there) - Any ideas why and how to resolve this as it would save me having to manually edit each time.
The code I have is:
VBA Code:
Sub Xport01Mon()
'
Sheets("Mon").Select
ActiveSheet.Unprotect
Dim ws As Worksheet
Dim table As Range
Dim pic As Picture
Dim cht As ChartObject
Dim myPath As String
Dim myPic As String
Dim myWidth As Long
Dim myHeight As Long
Set ws = ThisWorkbook.Sheets("Mon")
Set table = ws.Range("B5:X548")
myPath = "C:\Users\stevseat\Documents\001 - TST Schedule\"
myPic = Range("C1").Value
table.CopyPicture xlScreen, xlPicture
myWidth = table.Width
myHeight = table.Height
Set cht = ws.ChartObjects.Add(Left:=0, Top:=0, _
Width:=myWidth, Height:=myHeight)
cht.Activate
With cht.Chart
.Paste
.Export Filename:=myPath & myPic, Filtername:="png"
End With
cht.Delete
ActiveSheet.Protect
End Sub
This is what I am seeing as the output:
Any help you can provide would be greatly appreciated.
Thanks in advance