Chart re-size issue

sadath

Active Member
Joined
Oct 10, 2004
Messages
267
Office Version
  1. 365
Platform
  1. Windows
Hi All

I have code to load chart in image in user form.
below is the code

VBA Code:
Sub ChangeChart(ChartName As String)

Dim CurrentChart As Chart
Dim Fname As String
Fname = ThisWorkbook.Path & "\temp.gif"

Set CurrentChart = ThisWorkbook.Sheets("Sheet1").ChartObjects(ChartName).Chart

'CurrentChart.ChartArea.Width = UserForm1.Image1.Width
'CurrentChart.ChartArea.Height = UserForm1.Image1.Height
CurrentChart.Export Filename:=Fname, FilterName:="GIF"
UserForm1.Image1.Picture = LoadPicture(Fname)
End Sub



after loading userform, chart looks too small in user form

so i added this line CurrentChart.ChartArea.Width = UserForm1.Image1.Width
when this code is executed, my original chart (in Excel Sheet) got re-sized.

how i can re-size the picture in userform without affecting my original chart.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Try setting the PictureSizeMode property of the image as follows...

VBA Code:
UserForm1.Image1.PictureSizeMode =fmPictureSizeModeZoom

Hope this helps!
 
Upvote 0
Hi,
thank you, this is what i am looking for.
But one issue, chart's quality reduced...
 
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top