I have two Excel charts embedded on a form. I use code to create the charts on a spreadsheet, then, via a table which contains the links to the embedded objects, display the charts on the form.
The code is as follows:
1) GenerateChart "1,2", SF!txtWorkBook
2) X = CopyFile(SF!txtWorkBook, SF!txtResultsWorkbook, False)
3) Application.Echo False
4) SF!OLEChart1.ControlSource = "OLEChart1"
5) SF!OLEChart1.Visible = True
6) SF!OLEChart1.SetFocus
7) SF!OLEChart2.ControlSource = "OLEChart2"
8) SF!OLEChart2.Visible = True
9) SF!OLEChart2.SetFocus
10) Application.Echo True
Line 1 is my procedure for generating the charts on a fixed name spreadsheet which the program works with.
Line 2 copies the spreadsheet to a second, user defined spreadsheet.
Lines 4-6 and 7-9 is where the Charts are made visible on the form via linking to the fields on the table to which the form is bound.
The 2nd OLE control refreshes correctly (ie. the one ending up with the focus). The first will not refresh its contents until I physically click on it.
Here are my questions:
(a) How do I get all bound OLE controls to guarentee refresh to their underlying objects?
(b) I'd be quite happy to do away with the intermediate table objects, and make the charts unbound links. Any simple examples on how to do this would be appreciated.
Thanks in advance,
Steve
The code is as follows:
1) GenerateChart "1,2", SF!txtWorkBook
2) X = CopyFile(SF!txtWorkBook, SF!txtResultsWorkbook, False)
3) Application.Echo False
4) SF!OLEChart1.ControlSource = "OLEChart1"
5) SF!OLEChart1.Visible = True
6) SF!OLEChart1.SetFocus
7) SF!OLEChart2.ControlSource = "OLEChart2"
8) SF!OLEChart2.Visible = True
9) SF!OLEChart2.SetFocus
10) Application.Echo True
Line 1 is my procedure for generating the charts on a fixed name spreadsheet which the program works with.
Line 2 copies the spreadsheet to a second, user defined spreadsheet.
Lines 4-6 and 7-9 is where the Charts are made visible on the form via linking to the fields on the table to which the form is bound.
The 2nd OLE control refreshes correctly (ie. the one ending up with the focus). The first will not refresh its contents until I physically click on it.
Here are my questions:
(a) How do I get all bound OLE controls to guarentee refresh to their underlying objects?
(b) I'd be quite happy to do away with the intermediate table objects, and make the charts unbound links. Any simple examples on how to do this would be appreciated.
Thanks in advance,
Steve