Declare Function EssVConnect Lib "ESSEXCLN.XLL" (ByVal SheetName As Variant, ByVal username As Variant, ByVal Password As Variant, ByVal server As Variant, ByVal application As Variant, ByVal database As Variant) As Long
Declare Function EssVRetrieve Lib "ESSEXCLN.XLL" (ByVal SheetName As Variant, ByVal range As Variant, ByVal lockFlag As Variant) As Long
Declare Function EssVDisconnect Lib "ESSEXCLN.XLL" (ByVal SheetName As Variant) As Long
Declare Function EssVSendData Lib "ESSEXCLN.XLL" (ByVal SheetName As Variant, ByVal range As Variant) As Long
Declare Function EssVUnlock Lib "ESSEXCLN.XLL" (ByVal SheetName As Variant) As Long
Declare Function EssVZoomIn Lib "ESSEXCLN.XLL" (ByVal SheetName As Variant, ByVal range As Variant, ByVal selection As Variant, ByVal level As Variant, ByVal across As Variant) As Long
Declare Function EssVSetSheetOption Lib "ESSEXCLN.XLL" (ByVal SheetName As Variant, ByVal item As Variant, ByVal sheetOption As Variant) As Long
Dim strSingleCheck As String
Sub TestTopazConnection()
Dim sht As Worksheet, arrShtNames(0 To 256) As String
Dim i As Integer, j As Integer
Dim arrConnDetails As Variant
application.Calculation = xlCalculationManual
arrConnDetails = GetConnectDetails()
i = 0
Do While ConnectOnly(arrShtNames(j), _
CStr(arrConnDetails(1)), CStr(arrConnDetails(2)), CStr(arrConnDetails(3)), _
CStr(arrConnDetails(4)), CStr(arrConnDetails(5)), True) = True
application.Wait DateAdd("s", 10, Now)
Loop
MsgBox ("Connect successful")
application.Calculation = xlCalculationAutomatic
End Sub
Function ConnectOnly(strSheet As String, strPassword As String, strUser As String, strServer As String, strApp As String, strDB As String, blDisconnect As Boolean, Optional strRange As String) As Boolean
Dim x As Long, strMessage As String
x = EssVConnect(strSheet, strUser, strPassword, strServer, strApp, strDB)
If x <> 0 Then
ConnectOnly = False
Exit Function
Else
ConnectOnly = True
End If
If blDisconnect = True Then
x = EssVDisconnect(strSheet)
End If
End Function
|