Graphs Question

eddd82

Board Regular
Joined
Apr 25, 2002
Messages
107
OK I have a few graphs on my work sheets. I would like to put them onto some of my forms. Is there any way you can do this in the same way you do with putting the contents of cells onto a userform?
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
On 2002-05-10 06:00, eddd82 wrote:
OK I have a few graphs on my work sheets. I would like to put them onto some of my forms. Is there any way you can do this in the same way you do with putting the contents of cells onto a userform?

Brian....one way to do this is;

1) Save the graphs as (in this case) a gif
file.
2) Then load these in as required.

Code for 1)

<pre/>
Sub ChartPict_save()
Dim sFName As String
Dim Pict As Object
Dim ch
Dim i As Integer

i = 1
For Each Pict In ActiveSheet.ChartObjects
Set ch = Pict.Chart
sFName = ThisWorkbook.Path & Application.PathSeparator & "temp" & i & ".gif"
ch.Export Filename:=sFName, FilterName:="GIF"
i = i + 1
Next
Set ch = Nothing
End Sub
</pre>

Code 2

<pre/>
Image1.Picture = LoadPicture("C:testimg1.gif")

</pre>


Change as required or repost if unsure
 
Upvote 0
Sorry didnt read ure post probarly Code 1 will do what i want i think. Thanks a lot.

_________________
[Brian]
This message was edited by eddd82 on 2002-05-10 06:52
 
Upvote 0
Will this code reload the graph and change it to a gif each time. Do you get what im saying?
 
Upvote 0

Forum statistics

Threads
1,213,510
Messages
6,114,040
Members
448,543
Latest member
MartinLarkin

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