inactiveUser214710
Board Regular
- Joined
- Apr 27, 2012
- Messages
- 171
Hi everyone
I try as much as possible to be self-taught, and I face a difficulty that I cannot understand. The question is as follows:
In my spreadsheet I have a project which data, I prepared two different graphs. And the goal is to insert that charts in userform.
I introduced the respective codes, it worked and I recorded all the project. I left this project and entered to another consultation. Moments later, I opened the project above again, when, it is not my amazement, it gives an error. (Run time error "481": invalid picture).
I do not know what to do. Is there anyone who can help me? I would be very grateful for the help. thank you
take care with covid19
Jdcar
I try as much as possible to be self-taught, and I face a difficulty that I cannot understand. The question is as follows:
In my spreadsheet I have a project which data, I prepared two different graphs. And the goal is to insert that charts in userform.
I introduced the respective codes, it worked and I recorded all the project. I left this project and entered to another consultation. Moments later, I opened the project above again, when, it is not my amazement, it gives an error. (Run time error "481": invalid picture).
I do not know what to do. Is there anyone who can help me? I would be very grateful for the help. thank you
take care with covid19
Jdcar
VBA Code:
Dim currentchart As Chart
Dim ChartNum As Integer
''
Private Sub UserForm4_Initialize()
ChartNum = 2
UpdateChart 1
End Sub
Private Sub CboMonth_Change()
Sheets("ResumoDados").Range("c76").Value = CboMonth.Value
UpdateChart
UpdateChart1
End Sub
Private Sub cboGrDesp_Change()
Sheets("ResumoDados").Range("b76").Value = cboGrDesp.Value
UpdateChart
UpdateChart1
End Sub
''
Private Sub cmdout_Click()
Unload Me
End Sub
Private Sub UpdateChart()
Set currentchart = Sheets("charts").ChartObjects(1).Chart
currentchart.Parent.Width = 580
currentchart.Parent.Height = 220
'
' Save chart as GIF
PicFilename = ThisWorkbook.Path & "\" & "Mychart.gif"
currentchart.Export Filename:=PicFilename, filtername:="GIF"
' Show the chart
Image1.Picture = LoadPicture(PicFilename) ''<==Here is where Debug appear
End Sub
Private Sub UpdateChart1()
Set currentchart = Sheets("charts").ChartObjects(2).Chart
currentchart.Parent.Width = 580
currentchart.Parent.Height = 220
' Save chart as GIF
PicFilename = ThisWorkbook.Path & "\" & "Mychart.gif"
currentchart.Export Filename:=PicFilename, filtername:="GIF"
' Show the chart
Image2.Picture = LoadPicture(PicFilename)
End Sub
Private Sub cmdAll_Click()
UserForm6.Show
End Sub
Private Sub UserForm_Initialize()
ChartNum = 2
CboMonth.List = Array("JANEIRO", "FEVEREIRO", "MARÇO", "ABRIL", "MAIO", "JUNHO", "JULHO", "AGOSTO", _
"SETEMBRO", "OUTUBRO", "NOVEMBRO", "DEZEMBRO")
cboGrDesp.List = Array("Saúde", "Transporte", "Alimentação", "Desp.Fixas", "Impostos", "Desp.Ocasion", "AAA", "BBB", _
"CCC")
End Sub