Hi All
Im getting a run time error on
userfrom1.show vb modeless
It seemed to happen after i added this bit of code in....
Private Sub updatechart()
Dim CurrentChart As Chart
Dim Fname As String
Set CurrentChart = Sheets("Charts").ChartObjects(mChartNum).Chart
CurrentChart.Parent.Width = 280
CurrentChart.Parent.Height = 170
Fname = ThisWorkbook.Path & "\temp.gif"
CurrentChart.Export Filename:=Fname, FilterName:="GIF"
Image2.Picture = LoadPicture(Fname)
Me.Repaint
Set CurrentChart = Sheets("Charts").ChartObjects(mChartNum + 8).Chart
CurrentChart.Parent.Width = 280
CurrentChart.Parent.Height = 170
Fname = ThisWorkbook.Path & "\temp.gif"
CurrentChart.Export Filename:=Fname, FilterName:="GIF"
Image14.Picture = LoadPicture(Fname)
Me.Repaint
Set CurrentChart = Sheets("Charts").ChartObjects(mChartNum + 6).Chart
CurrentChart.Parent.Width = 270
CurrentChart.Parent.Height = 175
Fname = ThisWorkbook.Path & "\temp.gif"
CurrentChart.Export Filename:=Fname, FilterName:="GIF"
Image13.Picture = LoadPicture(Fname)
Me.Repaint
Set CurrentChart = Sheets("Charts").ChartObjects(mChartNum + 7).Chart
CurrentChart.Parent.Width = 270
CurrentChart.Parent.Height = 175
Fname = ThisWorkbook.Path & "\temp.gif"
CurrentChart.Export Filename:=Fname, FilterName:="GIF"
Image15.Picture = LoadPicture(Fname)
Me.Repaint
Set CurrentChart = Sheets("Charts").ChartObjects(mChartNum + 3).Chart
CurrentChart.Parent.Width = 342
CurrentChart.Parent.Height = 200
Fname = ThisWorkbook.Path & "\temp.gif"
CurrentChart.Export Filename:=Fname, FilterName:="GIF"
Image3.Picture = LoadPicture(Fname)
Me.Repaint
Set CurrentChart = Sheets("Charts").ChartObjects(mChartNum + 2).Chart
CurrentChart.Parent.Width = 270
CurrentChart.Parent.Height = 185
Fname = ThisWorkbook.Path & "\temp.gif"
CurrentChart.Export Filename:=Fname, FilterName:="GIF"
Image4.Picture = LoadPicture(Fname)
Me.Repaint
Set CurrentChart = Sheets("Charts").ChartObjects(mChartNum + 4).Chart
CurrentChart.Parent.Width = 342
CurrentChart.Parent.Height = 200
Fname = ThisWorkbook.Path & "\temp.gif"
CurrentChart.Export Filename:=Fname, FilterName:="GIF"
Image11.Picture = LoadPicture(Fname)
Me.Repaint
Set CurrentChart = Sheets("Charts").ChartObjects(mChartNum + 5).Chart
CurrentChart.Parent.Width = 270
CurrentChart.Parent.Height = 185
Fname = ThisWorkbook.Path & "\temp.gif"
CurrentChart.Export Filename:=Fname, FilterName:="GIF"
Image12.Picture = LoadPicture(Fname)
Me.Repaint
End Sub
Would anyone know where the error is coming from?, it only highlghts the userform1.show bit on the debug and my code to show the userform is this
Private Sub Workbook_Open()
Sheets("Charts").Select
ActiveWorkbook.RefreshAll
Sheets("Period 10 Summary").Select
Range("F2").Select
Calculate
UserForm1.Show vbModeless
End Sub
Any solution or advice would be great, as this is getting rather annoyign now
thanks Dan
Bookmarks