Excel Header File

Option Explicit
'
' sdSUN.DLL Version 02.02.04.
'
' Declarations for: Microsoft Excel
'
' Copyright C. Sunlit Design 2001
'
Private Declare Function sdVersion_notforworksheet Lib "sdsun.dll" Alias "sdVersion" () As String
Declare Function sdInfo Lib "sdsun.dll" Alias "sdInfo" () As Long
Private Declare Function sdMJDx_notforworksheet Lib "sdsun.dll" Alias "sdMJDx" (ByVal Year As Long, ByVal Month As Long, ByVal Day As Double, ByVal Hour As Double, ByVal Minute As Double, ByVal Sec As Double, ByVal TimeZone As Double) As String
Private Declare Function sdSDYx_notforworksheet Lib "sdsun.dll" Alias "sdSDYx" (ByVal Month As Long, ByVal Day As Double, ByVal Hour As Double, ByVal Minute As Double, ByVal Sec As Double, ByVal TimeZone As Double) As String
Private Declare Function sdUTDx_notforworksheet Lib "sdsun.dll" Alias "sdUTDx" (ByVal Hour As Double, ByVal Minute As Double, ByVal Sec As Double, ByVal TimeZone As Double) As String
Private Declare Function sdCTDx_notforworksheet Lib "sdsun.dll" Alias "sdCTDx" (ByVal Hour As Double, ByVal Minute As Double, ByVal Sec As Double) As String
Private Declare Function sdxDecl_notforworksheet Lib "sdsun.dll" Alias "sdxDecl" (ByVal Timex As String) As Double
Private Declare Function sdxEOT_notforworksheet Lib "sdsun.dll" Alias "sdxEOT" (ByVal Timex As String) As Double
Private Declare Function sdxH_notforworksheet Lib "sdsun.dll" Alias "sdxH" (ByVal Timex As String, ByVal Longitude As Double) As Double
Private Declare Function sdxAzi_notforworksheet Lib "sdsun.dll" Alias "sdxAzi" (ByVal Timex As String, ByVal Longitude As Double, ByVal Latitude As Double) As Double
Private Declare Function sdxAlt_notforworksheet Lib "sdsun.dll" Alias "sdxAlt" (ByVal Timex As String, ByVal Longitude As Double, ByVal Latitude As Double) As Double
Private Declare Function sdxFindAnnFeatx_notforworksheet Lib "sdsun.dll" Alias "sdxFindAnnFeatx" (ByVal Timex As String, ByVal Feature As Long) As String
Declare Function sdDMS2D Lib "sdsun.dll" Alias "sdDMS2D" (ByVal Sign As Long, ByVal Degree As Double, ByVal Minute As Double, ByVal Sec As Double) As Double
Declare Function sdD2Unit Lib "sdsun.dll" Alias "sdD2Unit" (ByVal Degree As Double, ByVal ToUnit As Long) As Double
Declare Function sdUnit2D Lib "sdsun.dll" Alias "sdUnit2D" (ByVal value As Double, ByVal FromUnit As Long) As Double
Declare Function sdEqu2Azi Lib "sdsun.dll" Alias "sdEqu2Azi" (ByVal H As Double, ByVal Latitude As Double, ByVal Decl As Double) As Double
Declare Function sdEqu2Alt Lib "sdsun.dll" Alias "sdEqu2Alt" (ByVal H As Double, ByVal Latitude As Double, ByVal Decl As Double) As Double
Declare Function sdSin Lib "sdsun.dll" Alias "sdSin" (ByVal Angle As Double) As Double
Declare Function sdCos Lib "sdsun.dll" Alias "sdCos" (ByVal Angle As Double) As Double
Declare Function sdTan Lib "sdsun.dll" Alias "sdTan" (ByVal Angle As Double) As Double
Declare Function sdATan Lib "sdsun.dll" Alias "sdATan" (ByVal Value As Double) As Double
Declare Function sdASin Lib "sdsun.dll" Alias "sdASin" (ByVal Value As Double) As Double
Declare Function sdACos Lib "sdsun.dll" Alias "sdACos" (ByVal Value As Double) As Double
Declare Function sdPI Lib "sdsun.dll" Alias "sdPI" () As Double
Private Declare Function sdxGetv_notforworksheet Lib "sdsun.dll" Alias "sdxGetv" (ByVal selector As String, ByVal xstring As String) As Double
Private Declare Function sdxTime2Text_notforworksheet Lib "sdsun.dll" Alias "sdxTime2Text" (ByVal Timex As String) As String
Private Declare Function sdxTimeUnpackx_notforworksheet Lib "sdsun.dll" Alias "sdxTimeUnpackx" (ByVal Timex As String) As String
Private Declare Function sdDUnpackx_notforworksheet Lib "sdsun.dll" Alias "sdDUnpackx" (ByVal Degree As Double) As String
Private Declare Function sdD2Text_notforworksheet Lib "sdsun.dll" Alias "sdD2Text" (ByVal Degree As Double) As String


' String variables for use in functions that convert Excel string types
Dim ans As String
Dim parm As String
Dim parm2 As String

' Constant definitions are in the form of functions callable from Excel Worksheets
' These are required, as VB constants are not available from Worksheets

' Define To/From Unit values for use in sdD2Unit and sdUnit2D functions
Function sdUnitDay() As Long
sdUnitDay = 10
End Function
Function sdUnitHour() As Long
sdUnitHour = 11
End Function
Function sdUnitTMin() As Long
sdUnitTMin = 12
End Function
Function sdUnitTSec() As Long
sdUnitTSec = 13
End Function
Function sdUnitDegree() As Long
sdUnitDegree = 14
End Function
Function sdUnitArcMin() As Long
sdUnitArcMin = 15
End Function
Function sdUnitArcSec() As Long
sdUnitArcSec = 16
End Function
Function sdUnitRadian() As Long
sdUnitRadian = 17
End Function
' Define Feature values for use in sdxfindannfeatx function
Function sdFeatEOTMaxMay() As Long
sdFeatEOTMaxMay = 40
End Function
Function sdFeatEOTMaxNov() As Long
sdFeatEOTMaxNov = 41
End Function
Function sdFeatEOTMinFeb() As Long
sdFeatEOTMinFeb = 42
End Function
Function sdFeatEOTMinJul() As Long
sdFeatEOTMinJul = 43
End Function
Function sdFeatEOTZeroApr() As Long
sdFeatEOTZeroApr = 44
End Function
Function sdFeatEOTZeroJun() As Long
sdFeatEOTZeroJun = 45
End Function
Function sdFeatEOTZeroSep() As Long
sdFeatEOTZeroSep = 46
End Function
Function sdFeatEOTZeroDec() As Long
sdFeatEOTZeroDec = 47
End Function
Function sdFeatDeclMax() As Long
sdFeatDeclMax = 48
End Function
Function sdFeatDeclMin() As Long
sdFeatDeclMin = 49
End Function
Function sdFeatDeclZeroMar() As Long
sdFeatDeclZeroMar = 50
End Function
Function sdFeatDeclZeroSep() As Long
sdFeatDeclZeroSep = 51
End Function
Function sdFeatAnalemmaCrossingApr() As Long
sdFeatAnalemmaCrossingApr = 52
End Function
Function sdFeatAnalemmaCrossingAug() As Long
sdFeatAnalemmaCrossingAug = 53
End Function
Function sdFeatSolsticeJun() As Long
sdFeatSolsticeJun = 54
End Function
Function sdFeatSolsticeDec() As Long
sdFeatSolsticeDec = 55
End Function
Function sdFeatEquinoxMar() As Long
sdFeatEquinoxMar = 56
End Function
Function sdFeatEquinoxSep() As Long
sdFeatEquinoxSep = 57
End Function

' Define DMS Sign Constants for use in Excel
Function sdDMSNorth() As Long
sdDMSNorth = 1
End Function
Function sdDMSSouth() As Long
sdDMSSouth = -1
End Function
Function sdDMSWest() As Long
sdDMSWest = 1
End Function
Function sdDMSEast() As Long
sdDMSEast = -1
End Function
Function sdDMSPlus() As Long
sdDMSPlus = 1
End Function
Function sdDMSMinus() As Long
sdDMSMinus = -1
End Function


' String Interface from Excel worksheet.
' Excel uses "Pascal" Strings whereas DLL uses AsciiZ strings
' Make VBA do automatic conversion of Pascal strings to AszciiZ strings.
'
Function sdVersion() As String
ans = sdVersion_notforworksheet()
sdVersion = ans
End Function

Function sdMJDx(ByVal Yearx As Long, ByVal Month As Long, ByVal Day As Double, ByVal Hour As Double, ByVal Minute As Double, ByVal Sec As Double, ByVal TimeZone As Double) As String
ans = sdMJDx_notforworksheet(Yearx, Month, Day, Hour, Minute, Sec, TimeZone)
sdMJDx = ans
End Function

Function sdSDYx(ByVal Month As Long, ByVal Day As Double, ByVal Hour As Double, ByVal Minute As Double, ByVal Sec As Double, ByVal TimeZone As Double) As String
ans = sdSDYx_notforworksheet(Month, Day, Hour, Minute, Sec, TimeZone)
sdSDYx = ans
End Function
Function sdUTDx(ByVal Hour As Double, ByVal Minute As Double, ByVal Sec As Double, ByVal TimeZone As Double) As String
ans = sdUTDx_notforworksheet(Hour, Minute, Sec, TimeZone)
sdUTDx = ans
End Function
Function sdCTDx(ByVal Hour As Double, ByVal Minute As Double, ByVal Sec As Double) As String
ans = sdCTDx_notforworksheet(Hour, Minute, Sec)
sdCTDx = ans
End Function
Function sdxDecl(Timex As String) As Double
parm = Timex
sdxDecl = sdxDecl_notforworksheet(parm)
End Function
Function sdxEOT(Timex As String) As Double
parm = Timex
sdxEOT = sdxEOT_notforworksheet(parm)
End Function
Function sdxH(Timex As String, ByVal Longitude As Double) As Double
parm = Timex
sdxH = sdxH_notforworksheet(parm, Longitude)
End Function
Function sdxAzi(Timex As String, ByVal Longitude As Double, ByVal Latitude As Double) As Double
parm = Timex
sdxAzi = sdxAzi_notforworksheet(parm, Longitude, Latitude)
End Function
Function sdxAlt(Timex As String, ByVal Longitude As Double, ByVal Latitude As Double) As Double
parm = Timex
sdxAlt = sdxAlt_notforworksheet(parm, Longitude, Latitude)
End Function
Function sdxFindAnnFeatx(Timex As String, Feature As Long) As String
ans = sdxFindAnnFeatx_notforworksheet(Timex, Feature)
sdxFindAnnFeatx = ans
End Function
Function sdxGetv(selector As String, xstring As String) As Double
parm = selector
parm2 = xstring
sdxGetv = sdxGetv_notforworksheet(parm, parm2)
End Function
Function sdxTime2Text(Timex As String) As String
parm = Timex
ans = sdxTime2Text_notforworksheet(parm)
sdxTime2Text = ans
End Function
Function sdxTimeUnpackx(Timex As String) As String
parm = Timex
ans = sdxTimeUnpackx_notforworksheet(parm)
sdxTimeUnpackx = ans
End Function
Function sdDUnpackx(Timex As String) As String
parm = Timex
ans = sdDUnpackx_notforworksheet(parm)
sdDUnpackx = ans
End Function
Function sdD2Text (ByVal Degree As Double) As String
ans = sdD2Text_notforworksheet(Degree)
sdD2Text = ans
End Function