PDA

View Full Version : AN error 481: Invalid pictur



DECOVT
01-21-2021, 02:23 PM
Hello
Guys

I'm having troubles to show properly the charts into a form.
I have 11 charts.
I already tried different ways. I am machine the vba code works fine, but when another user tries to access via OneDrive. I got the error message.




Private Sub UpdateChart()
'Save the chart in the GIF format
'Fname = ThisWorkbook.Path & Application.PathSeparator & "temp.gif"
FName = CreateObject("WScript.Shell").SpecialFolders("Desktop") & "\temp_chart.jpg"

'On Error Resume Next
'On Error GoTo 0

Set CurrentChart = Sheets(".").ChartObjects(ChartNum).Chart

CurrentChart.Parent.Width = 670
CurrentChart.Parent.Height = 360

CurrentChart.Export Filename:=FName, FilterName:="jpg"

' Load the chart to the form
Image1.Picture = LoadPicture(FName)

End Sub

mancubus
01-22-2021, 06:24 AM
https://support.microsoft.com/en-us/topic/error-481-invalid-picture-30910656-ac3e-0e44-92ee-a6a2dee5f4ee