Database Reference
In-Depth Information
With Sheet3
svRetVal = HypSetPOV(Empty, "Segments#" & .cboSegment.Text)
svRetVal = HypSetPOV(Empty, "Channels#" & .cboChannel.Text)
svRetVal = HypSetPOV(Empty, "Entity#" & .cboEntity.Text)
End With
MsgBox svRetVal
End Sub
10.4.13 Error Handling
one of the things you can count on in vBA is errors. The Smart view vBA functions
provide an error code to help diagnose problems. The problem is that an error number
is not very informative. Every Smart view vBA project will benefit from having some
form of error handling and interpretation. Doing this will greatly improve development
progress and at the same time reduce stress. The following is an example of catching and
interpreting errors in a Smart view vBA project:
Function s_SVGetErrorMsg(lErrorCode As Long, sSvFunc As String,
sXlFunc As String) As String
Dim sErrorMsg As String
' note: the list of errors here is not complete. The idea is to
convery
' to you the concept and let you code the rest on your own.
Select Case lErrorCode
Case 0
sErrorMsg = "Function ran successfully"
Case -1
sErrorMsg = "Valid return value, True"
Case -2
sErrorMsg = "Termination error"
Case -3
sErrorMsg = "Initialization error"
Case -4
sErrorMsg = "Spreadsheet is not yet connected to the
server"
Case -6
sErrorMsg = "Not used"
Case -7
sErrorMsg = "Spreadsheet has become unstable"
Case -8
sErrorMsg = "No Undo information exists"
Case Else
sErrorMsg = "Unspecified Error: " & CStr(lErrorCode)
End Select
s_SVGetErrorMsg = "SmartView error: " & sErrorMsg & " " &
sXlFunc & " " & sSvFunc & " " & lErrorCode
End Function
Sub handleSVError(lErrorCode As Long, sSvFunc As String, sXlFunc As
String)
Exit Sub
'If (ThisWorkbook.isDebug) Then MsgBox s_SVGetErrorMsg
(lErrorCode, sSvFunc, sXlFunc)
End Sub
Search WWH ::




Custom Search