[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Source code for t-test, chi-square and anova in vbscript (ideally)

Posted on 2004-11-03
Medium Priority
Last Modified: 2008-01-09

I am putting up a site that collects clinical data but the users want to get some simple looks at the data without exporting it to a statsitics package.

Does anyone know where I can get the source code (ideally in vbscript) for a t-test, chi-square and/or ANOVA?


Question by:levinho
  • 2

Expert Comment

ID: 12494871
Since you are using vbscript, presumably, you have access to Excel.
If so, why not reference that application in vbs and use its statistcal functions (it has all the ones you need)?

(Note: your Excel app needs the AnalysisToolPak referenced in the Addins collection.)


Author Comment

ID: 12495018
I appreciate the suggestion.  How would I go aboput doing that?

Can you point me to an explaination of how to reference Excel using asp?



Accepted Solution

Catalys earned 1000 total points
ID: 12495807
I don't think you can reference APIs in vbs, but you could wrap this below into a dll, which you could call in vbs

'Module declarations of API functions:
Declare Function FindWindow Lib "user32" Alias _
  "FindWindowA" (ByVal lpClassname As String, ByVal lpWindowName As Long) As Long
Declare Function SendMessage Lib "user32" Alias _
  "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, _
                  ByVal wParam As Long, lParam As Long) As Long
  Const WM_USER = 1024

Function RefExcelApp () as object

    If AppDetect("Excel") > 0 Then
        Set RefExcelApp = GetObject(, "Excel.Application")
        Set RefExcelApp = CreateObject("Excel.Application")
      End If

End sub

Function AppDetect(strApplicationClassName As String) As Long
'This procedure detects if an app is running and registers it.
  Dim hWnd As Long
  Dim lpClassname As String
  Select Case strApplicationClassName
    Case "CALC"
      lpClassname = "SciCalc"
    Case "NOTEPAD"
      lpClassname = "NOTEPAD"
    Case "EXCEL"
      lpClassname = "XLMAIN"
    Case "WORDPAD"
      lpClassname = "WordPadClass"
    Case "WORD"
      lpClassname = "OpusApp"
    Case "WINHELP"
      lpClassname = "MW_WINHELP"
    Case "PBRUSH"
      lpClassname = "MSPaintApp"
    Case "Explorer"
      lpClassname = "ieframe"
    Case Else
      lpClassname = strApplicationClassName
  End Select
  'This returns a valid handle number, or zero if app is not running
  hWnd = FindWindow(lpClassname, 0)
  AppDetect = hWnd
  If hWnd = 0 Then Exit Function
  SendMessage hWnd, WM_USER + 18, 0, 0   'app is running. Register it in the ROT
End Function


Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lithium-ion batteries area cornerstone of today's portable electronic devices, and even though they are relied upon heavily, their chemistry and origin are not of common knowledge. This article is about a device on which every smartphone, laptop, an…
This article covers the basics of data encryption, what it is, how it works, and why it's important. If you've ever wondered what goes on when you "encrypt" data, you can look here to build a good foundation for your personal learning.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question