Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OLE Problems with Excel 97 - Creating a chart with a she
Message
From
15/12/1999 07:25:45
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00303947
Message ID:
00303955
Views:
23
Hi Martin,

In one of my program I had some similar requirement. If you go through you could get an idea. In the form I had inserted a ole container control - Create from file "EachLine.XLS" and "display as icon" and named it "oLineGraph". I made its visible property to .F.

I guess you can follow the further steps on following routine.



With ThisForm.oLineGraph.Sheets(1)
* Worksheet cell A3 is named as LoadPort, B3 as fullmty
.Range('LoadPort').Value = MyLoadPort
.Range('fullmty').Value = "Full"
EndWith
Scan
Wait "Filling up with values" Nowait Window
With ThisForm.oLineGraph.Sheets(1)
If ThisForm.chkLineReport.Value = 1
ThisForm.cboLineCode.Value = Cursor_History.linecode
.Range('LineCode').Value = ThisForm.cboLineCode.DisplayValue
Else
.Range('LineCode').Value = "ALL"
EndIf
EndWith
For i = 1 To 3
With ThisForm.oLineGraph.Sheets(1).ChartObjects(i).Chart.Axes.Item(1)
.MajorUnit = 31
.MinorUnit = 6.2
.MinimumScale = nFirstMonth
.MaximumScale = nLastMonth
EndWith
EndFor
ThisForm.PrintGraph(1)
With ThisForm.oLineGraph.Sheets(1)
cLastRow = .Range('StartMonth').OffSet(12,9).Address
If !EoF() And Cursor_History.linecode = ThisForm.cboLineCode.Value
ThisForm.PrintGraph(2)
cLastRow = .Range('StartMonth').OffSet(28,9).Address
EndIf
If !EoF() And Cursor_History.linecode = ThisForm.cboLineCode.Value
ThisForm.PrintGraph(3)
cLastRow = .Range('StartMonth').OffSet(44,9).Address
EndIf
.Calculate
Wait "Printing the report" Nowait Window

.Range("A1:"+cLastRow).PrintOut
Wait "Clearing the contents of Excel file" Nowait Window
* Now clear the contents

cLastRow = .Range('StartMonth').OffSet(-5,2).Address
For i = 1 To 3
cFirstRow = .Range(cLastRow).OffSet(5,-2).Address
cLastRow = .Range(cFirstRow).OffSet(11,2).Address
.Range(cFirstRow+":"+cLastRow).ClearContents
EndFor
EndWith

* Following to nullify the Do While Skip effect through ThisForm.printgraph
Skip -1 In Cursor_History
EndScan
Wait Clear
Previous
Reply
Map
View

Click here to load this message in the networking platform