MACROS AND VISUAL BASIC
LSM 710 and LSM 780
Carl Zeiss
VBA PROGRAMMING FOR LSM
Systems
34 M60-1-0025
e
02/2010
Example:
Type CALIBRATION_PARAM
lambda As Long
angle As Double
Translation As Double
End Type
Function DataFromCalibFile(strGetFile As String, calibArray() As CALIBRATION_PARAM) As Integer
Dim hFile As Long
Dim strLine As String
Dim varData(1 To 3) As Variant
Dim paramCnt As Integer
paramCnt = -1
‘get the next free file handle
hFile = FreeFile
‘check if file exist
If (Len(Dir(strGetFile)) > 0) Then
Open strGetFile For Input Access Read Shared As hFile
If (Not EOF(hFile)) Then
Line Input #hFile, strLine
paramCnt = 0
Do Until EOF(hFile)
Input #hFile, varData(1), varData(2), varData(3)
calibArray(paramCnt).lambda = varData(1)
calibArray(paramCnt).angle = varData(2)
calibArray(paramCnt).Translation = varData(3)
paramCnt = pa 1
Loop
End If
Close #hFile
End If
DataFromCalibFile = paramCnt
End Function Objektstruktur
Use of the API function for additional functionality