Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

copying chart into a userform 1

Status
Not open for further replies.

tedbrander

Technical User
Apr 4, 2008
1
CA
I'm using userforms within excel 2003. I have made an excel document which essentially obtains information from a "user input" userform, then uses this data to create a chart in excel. I want to then display the chart in an "output" userform so as to display an output back to the user. My problem is that I don't know how to display the chart that was created in a userform, can anybody help me out, please?
 

Hi Tedbrander the trick is to save the chart as a "GIF"

FILE then create a image control on your user form that

calls the GIF FILE. First step is to create your chart then

play with this code.

Code:
Sub Create_GIF()
Dim MyChart

 On Error GoTo ErrorHandler

'Create Chart as gif file
   Set MyChart = ActiveSheet.ChartObjects(1).Chart
   mychart.Export FileName:="c:\Mychart.gif",    
   FilterName:="GIF"

'Load the image from your file
'into your image control
   Image1.LoadPicture(FilterName)

Exit Sub
ErrorHandler:
    MsgBox Err.Description, vbCritical, "Error"
End Sub


Regards,

dstrat6
 




dstrat6,

Good tip! ==> *

Skip,

[glasses]Have you heard that the roundest knight at King Arthur's round table was...
Sir Cumference![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top