Changed to find the statistics test document instead of using ThisComponent.
This commit is contained in:
parent
e2e4dafeba
commit
baa4275099
18
_0Main.vb
18
_0Main.vb
@ -12,6 +12,7 @@ Sub subMain
|
|||||||
'MsgBox InStr (1, "abca", "ad")
|
'MsgBox InStr (1, "abca", "ad")
|
||||||
'Xray ThisComponent.getSheets.getByIndex (0).getCellByPosition (0, 0)
|
'Xray ThisComponent.getSheets.getByIndex (0).getCellByPosition (0, 0)
|
||||||
'subTestCorrelation
|
'subTestCorrelation
|
||||||
|
subTestChi2GoodnessOfFit
|
||||||
|
|
||||||
MsgBox "Done. " & Format (Now - dStart, "mm:ss") & " elapsed."
|
MsgBox "Done. " & Format (Now - dStart, "mm:ss") & " elapsed."
|
||||||
End Sub
|
End Sub
|
||||||
@ -54,3 +55,20 @@ Function fnGetLocalRangeName (oRange As Object) As String
|
|||||||
End If
|
End If
|
||||||
fnGetLocalRangeName = sName
|
fnGetLocalRangeName = sName
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
' fnFindStatsTestDocument: Finds the statistics test document.
|
||||||
|
Function fnFindStatsTestDocument As Object
|
||||||
|
Dim oEnum As Object, oDoc As Object
|
||||||
|
|
||||||
|
oEnum = StarDesktop.getComponents.createEnumeration
|
||||||
|
Do While oEnum.hasMoreElements
|
||||||
|
oDoc = oEnum.nextElement
|
||||||
|
If oDoc.supportsService ("com.sun.star.document.OfficeDocument") Then
|
||||||
|
If Right (oDoc.getLocation, Len ("/statstest.ods")) = "/statstest.ods" Then
|
||||||
|
fnFindStatsTestDocument = oDoc
|
||||||
|
Exit Function
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Loop
|
||||||
|
fnFindStatsTestDocument = Null
|
||||||
|
End Function
|
||||||
|
14
_1CorRel.vb
14
_1CorRel.vb
@ -5,11 +5,17 @@ Option Explicit
|
|||||||
|
|
||||||
' subTestCorrelation: Tests the Pearson’s correlation coefficient report
|
' subTestCorrelation: Tests the Pearson’s correlation coefficient report
|
||||||
Sub subTestCorrelation
|
Sub subTestCorrelation
|
||||||
Dim oSheets As Object, sSheetName As String
|
Dim oDoc As Object, oSheets As Object, sSheetName As String
|
||||||
Dim oSheet As Object, oRange As Object
|
Dim oSheet As Object, oRange As Object
|
||||||
|
|
||||||
|
oDoc = fnFindStatsTestDocument
|
||||||
|
If oDoc = Null Then
|
||||||
|
MsgBox "Cannot find statstest.ods in the opened documents."
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
|
||||||
sSheetName = "correl"
|
sSheetName = "correl"
|
||||||
oSheets = ThisComponent.getSheets
|
oSheets = oDoc.getSheets
|
||||||
If Not oSheets.hasByName (sSheetName) Then
|
If Not oSheets.hasByName (sSheetName) Then
|
||||||
MsgBox "Data sheet """ & sSheetName & """ not found"
|
MsgBox "Data sheet """ & sSheetName & """ not found"
|
||||||
Exit Sub
|
Exit Sub
|
||||||
@ -17,9 +23,9 @@ Sub subTestCorrelation
|
|||||||
If oSheets.hasByName (sSheetName & "_correl") Then
|
If oSheets.hasByName (sSheetName & "_correl") Then
|
||||||
oSheets.removeByName (sSheetName & "_correl")
|
oSheets.removeByName (sSheetName & "_correl")
|
||||||
End If
|
End If
|
||||||
oSheet = ThisComponent.getSheets.getByName (sSheetName)
|
oSheet = oSheets.getByName (sSheetName)
|
||||||
oRange = oSheet.getCellRangeByName ("B3:C13")
|
oRange = oSheet.getCellRangeByName ("B3:C13")
|
||||||
subReportCorrelation (ThisComponent, oRange)
|
subReportCorrelation (oDoc, oRange)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
' subReportCorrelation: Reports the Pearson’s correlation coefficient
|
' subReportCorrelation: Reports the Pearson’s correlation coefficient
|
||||||
|
14
_2PTTest.vb
14
_2PTTest.vb
@ -4,11 +4,17 @@ Option Explicit
|
|||||||
|
|
||||||
' subTestPairedTTest: Tests the paired T-test report
|
' subTestPairedTTest: Tests the paired T-test report
|
||||||
Sub subTestPairedTTest
|
Sub subTestPairedTTest
|
||||||
Dim oSheets As Object, sSheetName As String
|
Dim oDoc As Object, oSheets As Object, sSheetName As String
|
||||||
Dim oSheet As Object, oRange As Object
|
Dim oSheet As Object, oRange As Object
|
||||||
|
|
||||||
|
oDoc = fnFindStatsTestDocument
|
||||||
|
If oDoc = Null Then
|
||||||
|
MsgBox "Cannot find statstest.ods in the opened documents."
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
|
||||||
sSheetName = "pttest"
|
sSheetName = "pttest"
|
||||||
oSheets = ThisComponent.getSheets
|
oSheets = oDoc.getSheets
|
||||||
If Not oSheets.hasByName (sSheetName) Then
|
If Not oSheets.hasByName (sSheetName) Then
|
||||||
MsgBox "Data sheet """ & sSheetName & """ not found"
|
MsgBox "Data sheet """ & sSheetName & """ not found"
|
||||||
Exit Sub
|
Exit Sub
|
||||||
@ -16,9 +22,9 @@ Sub subTestPairedTTest
|
|||||||
If oSheets.hasByName (sSheetName & "_ttest") Then
|
If oSheets.hasByName (sSheetName & "_ttest") Then
|
||||||
oSheets.removeByName (sSheetName & "_ttest")
|
oSheets.removeByName (sSheetName & "_ttest")
|
||||||
End If
|
End If
|
||||||
oSheet = ThisComponent.getSheets.getByName (sSheetName)
|
oSheet = oSheets.getByName (sSheetName)
|
||||||
oRange = oSheet.getCellRangeByName ("B3:C15")
|
oRange = oSheet.getCellRangeByName ("B3:C15")
|
||||||
subReportPairedTTest (ThisComponent, oRange)
|
subReportPairedTTest (oDoc, oRange)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
' subReportPairedTTest: Reports the paired T-test
|
' subReportPairedTTest: Reports the paired T-test
|
||||||
|
14
_3ITTest.vb
14
_3ITTest.vb
@ -4,11 +4,17 @@ Option Explicit
|
|||||||
|
|
||||||
' subTestIndependentTTest: Tests the independent T-test report
|
' subTestIndependentTTest: Tests the independent T-test report
|
||||||
Sub subTestIndependentTTest
|
Sub subTestIndependentTTest
|
||||||
Dim oSheets As Object, sSheetName As String
|
Dim oDoc As Object, oSheets As Object, sSheetName As String
|
||||||
Dim oSheet As Object, oRange As Object
|
Dim oSheet As Object, oRange As Object
|
||||||
|
|
||||||
|
oDoc = fnFindStatsTestDocument
|
||||||
|
If oDoc = Null Then
|
||||||
|
MsgBox "Cannot find statstest.ods in the opened documents."
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
|
||||||
sSheetName = "ittest"
|
sSheetName = "ittest"
|
||||||
oSheets = ThisComponent.getSheets
|
oSheets = oDoc.getSheets
|
||||||
If Not oSheets.hasByName (sSheetName) Then
|
If Not oSheets.hasByName (sSheetName) Then
|
||||||
MsgBox "Data sheet """ & sSheetName & """ not found"
|
MsgBox "Data sheet """ & sSheetName & """ not found"
|
||||||
Exit Sub
|
Exit Sub
|
||||||
@ -19,9 +25,9 @@ Sub subTestIndependentTTest
|
|||||||
If oSheets.hasByName (sSheetName & "_ttesttmp") Then
|
If oSheets.hasByName (sSheetName & "_ttesttmp") Then
|
||||||
oSheets.removeByName (sSheetName & "_ttesttmp")
|
oSheets.removeByName (sSheetName & "_ttesttmp")
|
||||||
End If
|
End If
|
||||||
oSheet = ThisComponent.getSheets.getByName (sSheetName)
|
oSheet = oSheets.getByName (sSheetName)
|
||||||
oRange = oSheet.getCellRangeByName ("A15:B34")
|
oRange = oSheet.getCellRangeByName ("A15:B34")
|
||||||
subReportIndependentTTest (ThisComponent, oRange)
|
subReportIndependentTTest (oDoc, oRange)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
' subReportIndependentTTest: Reports the independent T-test
|
' subReportIndependentTTest: Reports the independent T-test
|
||||||
|
14
_4ANOVA.vb
14
_4ANOVA.vb
@ -4,11 +4,17 @@ Option Explicit
|
|||||||
|
|
||||||
' subTestANOVA: Tests the ANOVA (Analyze of Variances) report
|
' subTestANOVA: Tests the ANOVA (Analyze of Variances) report
|
||||||
Sub subTestANOVA
|
Sub subTestANOVA
|
||||||
Dim oSheets As Object, sSheetName As String
|
Dim oDoc As Object, oSheets As Object, sSheetName As String
|
||||||
Dim oSheet As Object, oRange As Object
|
Dim oSheet As Object, oRange As Object
|
||||||
|
|
||||||
|
oDoc = fnFindStatsTestDocument
|
||||||
|
If oDoc = Null Then
|
||||||
|
MsgBox "Cannot find statstest.ods in the opened documents."
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
|
||||||
sSheetName = "anova"
|
sSheetName = "anova"
|
||||||
oSheets = ThisComponent.getSheets
|
oSheets = oDoc.getSheets
|
||||||
If Not oSheets.hasByName (sSheetName) Then
|
If Not oSheets.hasByName (sSheetName) Then
|
||||||
MsgBox "Data sheet """ & sSheetName & """ not found"
|
MsgBox "Data sheet """ & sSheetName & """ not found"
|
||||||
Exit Sub
|
Exit Sub
|
||||||
@ -19,9 +25,9 @@ Sub subTestANOVA
|
|||||||
If oSheets.hasByName (sSheetName & "_anovatmp") Then
|
If oSheets.hasByName (sSheetName & "_anovatmp") Then
|
||||||
oSheets.removeByName (sSheetName & "_anovatmp")
|
oSheets.removeByName (sSheetName & "_anovatmp")
|
||||||
End If
|
End If
|
||||||
oSheet = ThisComponent.getSheets.getByName (sSheetName)
|
oSheet = oSheets.getByName (sSheetName)
|
||||||
oRange = oSheet.getCellRangeByName ("A13:B35")
|
oRange = oSheet.getCellRangeByName ("A13:B35")
|
||||||
subReportANOVA (ThisComponent, oRange)
|
subReportANOVA (oDoc, oRange)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
' subReportANOVA: Reports the ANOVA (Analyze of Variances)
|
' subReportANOVA: Reports the ANOVA (Analyze of Variances)
|
||||||
|
14
_5Chi2GoF.vb
14
_5Chi2GoF.vb
@ -4,11 +4,17 @@ Option Explicit
|
|||||||
|
|
||||||
' subTestChi2GoodnessOfFit: Tests the chi-square goodness of fit report
|
' subTestChi2GoodnessOfFit: Tests the chi-square goodness of fit report
|
||||||
Sub subTestChi2GoodnessOfFit
|
Sub subTestChi2GoodnessOfFit
|
||||||
Dim oSheets As Object, sSheetName As String
|
Dim oDoc As Object, oSheets As Object, sSheetName As String
|
||||||
Dim oSheet As Object, oRange As Object
|
Dim oSheet As Object, oRange As Object
|
||||||
|
|
||||||
|
oDoc = fnFindStatsTestDocument
|
||||||
|
If oDoc = Null Then
|
||||||
|
MsgBox "Cannot find statstest.ods in the opened documents."
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
|
||||||
sSheetName = "chi2"
|
sSheetName = "chi2"
|
||||||
oSheets = ThisComponent.getSheets
|
oSheets = oDoc.getSheets
|
||||||
If Not oSheets.hasByName (sSheetName) Then
|
If Not oSheets.hasByName (sSheetName) Then
|
||||||
MsgBox "Data sheet """ & sSheetName & """ not found"
|
MsgBox "Data sheet """ & sSheetName & """ not found"
|
||||||
Exit Sub
|
Exit Sub
|
||||||
@ -16,9 +22,9 @@ Sub subTestChi2GoodnessOfFit
|
|||||||
If oSheets.hasByName (sSheetName & "_chi2") Then
|
If oSheets.hasByName (sSheetName & "_chi2") Then
|
||||||
oSheets.removeByName (sSheetName & "_chi2")
|
oSheets.removeByName (sSheetName & "_chi2")
|
||||||
End If
|
End If
|
||||||
oSheet = ThisComponent.getSheets.getByName (sSheetName)
|
oSheet = oSheets.getByName (sSheetName)
|
||||||
oRange = oSheet.getCellRangeByName ("A7:B192")
|
oRange = oSheet.getCellRangeByName ("A7:B192")
|
||||||
subReportChi2GoodnessOfFit (ThisComponent, oRange)
|
subReportChi2GoodnessOfFit (oDoc, oRange)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
' subReportChi2GoodnessOfFit: Reports the chi-square goodness of fit
|
' subReportChi2GoodnessOfFit: Reports the chi-square goodness of fit
|
||||||
|
Loading…
Reference in New Issue
Block a user