Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Embedding Existing Excel chart into VB6 form
This is a code for vb6 programmers
--------------------------------- Dim xl, wbk Private Sub Command1_Click() Set ThisChart = wbk.sheets(1).ChartObjects(1).Chart fName = CurDir & "\LiveChart.GIF" ThisChart.Export FileName:=fName, FilterName:="gif" Picture1.Picture = LoadPicture(fName) End Sub Private Sub Form_Load() Set xl = CreateObject("Excel.application") Set wbk = xl.workbooks.open(CurDir & "\LiveChart.xlsx") End Sub Private Sub Form_Unload(Cancel As Integer) On Error Resume Next xl.displayalerts = False wbk.save wbk.Close Set xl = Nothing End Sub |
#2
|
|||
|
|||
Quote:
|
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Embedding Existing Excel chart into VB6 form
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next xl.displayalerts = False wbk.save wbk.Close Set xl = Nothing End Sub You'll find this more efficient... Private Sub Form_Unload(Cancel As Integer) On Error Resume Next xl.wbk.Close False '//no changes so don't save xl.Quit: Set wbk = Nothing: Set xl = Nothing End Sub ...because it cleans up VB6 properly AND doesn't leave Excel running with DisplayAlerts turned off! (Closing a workbook and specifying the SaveChanges arg effectively cancels the "Do you want to save..." alert!) -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Embedding a pie chart from excel | Charts and Charting in Excel | |||
Embedding an annotation or a comment to a chart in Excel 2007 | Charts and Charting in Excel | |||
Embedding spreadsheet in a user form | Excel Discussion (Misc queries) | |||
Can I scan an existing paper form into excel | Excel Discussion (Misc queries) | |||
Embedding excel charts in my C# windows form | Charts and Charting in Excel |