Hello, so i've been running this macro now for several years daily to output football statistics, randomly today its throwing this error at me and i have no idea how to solve it!
please help!! thank you in advance
rgExp.CopyPicture Appearance:=xlScreen, Format:=xlBitmap <----------- debug highlights this line
please help!! thank you in advance
rgExp.CopyPicture Appearance:=xlScreen, Format:=xlBitmap <----------- debug highlights this line
VBA Code:
Sub CharlieExport()
Dim filename1 As String
Dim Path As String
Dim Myrange As String
Dim dvCell As Range
Dim inputRange As Range
Dim c As Range
Dim i As Long
Set dvCell = Worksheets("Fixtures").Range("L1")
Set inputRange = Evaluate(dvCell.Validation.Formula1)
i = 1
Application.ScreenUpdating = True
For Each c In inputRange
dvCell = c.Value
Myrange = Worksheets("Macro Info").Range("B4").Value
Dim rgExp As Range: Set rgExp = Worksheets("ministat").Range(Myrange)
''' Copy range as picture onto Clipboard
rgExp.CopyPicture Appearance:=xlScreen, Format:=xlBitmap
Application.ScreenUpdating = True
''' Create an empty chart with exact size of range copied
With ActiveSheet.ChartObjects.Add(Left:=rgExp.Left, Top:=rgExp.Top, _
Width:=rgExp.Width, Height:=rgExp.Height)
.Name = "TempChart"
.Activate
End With
''' Paste into chart area, export to file, delete chart.
Application.ScreenUpdating = True
ActiveChart.Paste
Application.Wait (Now + TimeValue("0:00:01"))
Path = Worksheets("Macro Info").Range("K6").Value
filename1 = Worksheets("ministat").Range("A11") & "Mini-10" & ".jpeg"
ActiveSheet.ChartObjects("TempChart").Chart.Export (Path & filename1)
ActiveSheet.ChartObjects("TempChart").Delete
Next c
Application.ScreenUpdating = True
MsgBox ("Saved")
End Sub