I have two pieces of code that do essentially the same job. They both copy a Chart to a GIF file and then Load the Image onto a form. The charts would appear to be the same size in both instances. Unfortunately when the charts are created as a GIF image the sizes of the images are different. The first chart’s image size, in pixels, is 907 (width) by 378 (length) & the second chart’s image size is 1209 (width) by 493 (length).
Due the difference in the GIF image sizes they don’t both fit into the same Image window on the Form
I don’t understand why the images created are different sizes, and because of the Project design I need the initial Charts to be the same size as well as the Images of the Charts.
Can anyone shed light on why this might be happening?
Code for first chart.....
Dim CurrentChart As Chart
Dim Fname As String
'Create chart as an image then load to Form
Set CurrentChart = Workbooks("Util1.xls").Sheets("PerfChart").ChartObjects(1).Chart
Fname = ThisWorkbook.Path & "\DATA\CHART\Team1.gif"
CurrentChart.Export Filename:=Fname, FilterName:="GIF"
Image1.Picture = LoadPicture(Fname)
Code for second chart.....
Dim Fname As String
'Create chart as an image then load to Form
FName = ThisWorkbook.Path & "\DATA\CHART\Region.gif"
Workbooks("Newp.xls").Sheets("PerfChart").ChartObjects(1).Chart.Export _
Filename:=FName, FilterName:="GIF"
Image1.Picture = LoadPicture(FName)
Bookmarks