O
ojv
Have code which loads a gif file to an image control. If I have a breakpoint
in the code the gif file loads beatuifully to the image sized as it should
be. If i do not have a breakpoint it appears to size somewhat at its own
will. Any suggestions why this could be? Code below.
n = ActiveSheet.ChartObjects.Count
ActiveSheet.ChartObjects(n).Height = Image1.Height '300
ActiveSheet.ChartObjects(n).Width = Image1.Width '320
.PlotArea.Left = 20
.PlotArea.Top = 15
.PlotArea.Height = Image1.Height - 30 '160
.PlotArea.Width = Image1.Width - 25 '300
If obXY.Value Then .Axes(xlCategory).AxisTitle.Top = Image1.Height
If .Axes(xlValue, xlPrimary).HasTitle = True Then
..Axes(xlValue).AxisTitle.Left = 1
If .HasTitle = True Then .ChartTitle.Top = 3
End With
Set CurrentChart = ActiveSheet.ChartObjects(n).Chart
'''Save chart as GIF
FName = ThisWorkbook.Path & Application.PathSeparator & "temp.gif"
CurrentChart.Export FileName:=FName, FilterName:="GIF"
'''Show the chart
Image1.Picture = LoadPicture(FName)
in the code the gif file loads beatuifully to the image sized as it should
be. If i do not have a breakpoint it appears to size somewhat at its own
will. Any suggestions why this could be? Code below.
n = ActiveSheet.ChartObjects.Count
ActiveSheet.ChartObjects(n).Height = Image1.Height '300
ActiveSheet.ChartObjects(n).Width = Image1.Width '320
.PlotArea.Left = 20
.PlotArea.Top = 15
.PlotArea.Height = Image1.Height - 30 '160
.PlotArea.Width = Image1.Width - 25 '300
If obXY.Value Then .Axes(xlCategory).AxisTitle.Top = Image1.Height
If .Axes(xlValue, xlPrimary).HasTitle = True Then
..Axes(xlValue).AxisTitle.Left = 1
If .HasTitle = True Then .ChartTitle.Top = 3
End With
Set CurrentChart = ActiveSheet.ChartObjects(n).Chart
'''Save chart as GIF
FName = ThisWorkbook.Path & Application.PathSeparator & "temp.gif"
CurrentChart.Export FileName:=FName, FilterName:="GIF"
'''Show the chart
Image1.Picture = LoadPicture(FName)