help refreshing a image in userform

JasonLeVan

Board Regular
Joined
Feb 7, 2011
Messages
121
Sub userchart248()

Set Currentchart = Sheets("248chart").ChartObjects(1).Chart
fname = ThisWorkbook.Path & "\248chart.gif"
Currentchart.Export Filename:=fname, filtername:="GIF"
End Sub


here is a code i am using to take a chart that is on tab 248chart and save it to a image, i would then like to put that image into a userform which i can do, my problem is when the image is changed and resaved i pull up the old image not the new one in my userform, how can i make the userform reload, or refresh that image
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Hi there,

This is how I do it:

Code:
Private Sub UserForm_Initialize()
    ChartNum = 1
    UpdateChart
End Sub

Private Sub UpdateChart()
    Set CurrentChart = Sheets("YTD PIVOT & CHART").ChartObjects(ChartNum).Chart

    Fname = ThisWorkbook.Path & Application.PathSeparator & "temp.gif"
    CurrentChart.Export Filename:=Fname, FilterName:="GIF"

    Image1.Picture = LoadPicture(Fname)
End Sub
 
Upvote 0
i kinda understand, so this code below, i copy and put into the userform code area or the workbook area, thats where i am confused, and also where it says temp.gif and it be the file i chose to name it or is the temp relevent to making this work. thanks

Hi there,

This is how I do it:

Code:
Private Sub UserForm_Initialize()
    ChartNum = 1
    UpdateChart
End Sub
 
Private Sub UpdateChart()
    Set CurrentChart = Sheets("YTD PIVOT & CHART").ChartObjects(ChartNum).Chart
 
    Fname = ThisWorkbook.Path & Application.PathSeparator & "temp.gif"
    CurrentChart.Export Filename:=Fname, FilterName:="GIF"
 
    Image1.Picture = LoadPicture(Fname)
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,551
Messages
6,179,470
Members
452,915
Latest member
hannnahheileen

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