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