![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Apr 2002
Location: Ireland
Posts: 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?
__________________
[Brian] |
|
|
|
|
|
#2 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Quote:
1) Save the graphs as (in this case) a gif file. 2) Then load these in as required. Code for 1) 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 Code 2 Image1.Picture = LoadPicture("C:testimg1.gif") Change as required or repost if unsure |
|
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Apr 2002
Location: Ireland
Posts: 107
|
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 ] |
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Apr 2002
Location: Ireland
Posts: 107
|
Will this code reload the graph and change it to a gif each time. Do you get what im saying?
__________________
[Brian] |
|
|
|
|
|
#5 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Brian have a look here for other examples
http://www.bmsltd.co.uk/Excel/Default.htm Look @ PastePicture.zip file this maybe of use to you. |
|
|
|
|
|
#6 |
|
Board Regular
Join Date: Apr 2002
Location: Ireland
Posts: 107
|
That did the job perfect. Thanks for the help.
__________________
[Brian] |
|
|
|
|
|
#7 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Columbus, OH, USA
Posts: 3,519
|
Quote:
|
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|