Hi Anne,
I can't see anything in that Microsoft document that says that CancelError is supposed to contain the return value. This property functions as described
here and it is used to cause an error to occur when the CancelError property is set to True. You use error-handling to catch the error when the user clicks Cancel.
In VBScript (and SUD dialogs in DIAdem) you can use the error-handling method described in the DIAdem help topic "On Error statement" to catch the error that occurs when the user clicks Cancel.
Here's how I used this method:
' CancelError is True, but we will catch errors.
On Error Resume Next
M
SCommonDlgAX.X.CancelError = True
' Set filters.
MSCommonDlgAX.X.Filter = "All Files (*.*)|*.*|Text Files (*.txt)|*.txt|Batch Files (*.bat)|*.bat"
' Specify default filter.
MSCommonDlgAX.X.FilterIndex = 2
' Display the Open dialog box.
MSCommonDlgAX.X.ShowOpen
' An error will have occurred if the user clicked Cancel.
If (Err.Number <> 0) Then
Msgbox "User clicked cancel"
Else
Msgbox MSCommonDlgAX.X.FileName
End If
On Error Goto 0
Hope this helps you get started,
David Mc.
NI Application Engineer