weiser386
New Member
- Joined
- Sep 2, 2015
- Messages
- 10
I'm trying to export a screenshot with my macro and I'd like it to save as a date and time format...I think I'm some what close but I need help.
Thank you in advance
Thank you in advance
Code:
Sub CopyRangeToGIF()
' save a range from Excel as a picture
Dim rng As Excel.Range
Dim cht As Excel.ChartObject
Dim FName As String
FName = "S:\folder\folder\ Screenshots\" & _
Format(Date, "ddmmmyyyy") & ".xlsm"
Const strPath As String = "S:\folder\folder\ Screenshots\"
Application.ScreenUpdating = False
Set rng = Worksheets("WorkSheet1").Range("A1:K21")
rng.CopyPicture xlScreen, xlPicture
Set cht = ActiveSheet.ChartObjects.Add(0, 0, rng.Width + 10, rng.Height + 10)
cht.Chart.Paste
cht.Chart.Export strPath & FName
cht.Delete
ExitProc:
Application.ScreenUpdating = True
Set cht = Nothing
Set rng = Nothing
End Sub