help with userform

JasonLeVan

Board Regular
Joined
Feb 7, 2011
Messages
121
I have a userform, and i have a chart on sheet2. I have a macro that saves the chart as a image then in the userform i have a image link of that chart, works great. except that if i make a change to the chart data, then save the picture and run the userform it does not load the newest picture, is there a way to make the userform refresh itself to the newest version of the saved picture
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Try this :-
Place a Image frame in you userform "Image1" then run this code in the Userform Initialize _Event.
This will save your chart as a "gif" image file, and insert it on you sheet, refreshed each time the Image is loaded.
Code:
Private Sub UserForm_Initialize()
Dim Currentchart As Chart
Dim fname As String
Set Currentchart = Sheets("Sheet1").ChartObjects(1).Chart
fname = ThisWorkbook.Path & "\temp.gif"
Currentchart.Export Filename:=fname, filtername:="Gif"
Image1.Picture = LoadPicture(fname)
End Sub
Mick
 
Upvote 0

Forum statistics

Threads
1,224,574
Messages
6,179,633
Members
452,933
Latest member
patv

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