ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Com Interop Errorcode (https://www.excelbanter.com/excel-programming/424871-com-interop-errorcode.html)

Raja

Com Interop Errorcode
 
Hi,

where can I find the meaning of the error code that retun from the com interop

Regards,
Raja

Gary Brown[_5_]

Com Interop Errorcode
 
In your procedure's error handling, put something like...

Debug.Print err.number & " - " & Err.Description

or

Msgbox err.number & " - " & Err.Description

--
Hope this helps.
If it does, please click the Yes button.
Thanks in advance for your feedback.
Gary Brown



"Raja" wrote:

Hi,

where can I find the meaning of the error code that retun from the com interop

Regards,
Raja


Raja

Com Interop Errorcode
 
Yes, I know that. I mean what the number means? where I can find a list
of all numbers?

For exmaple, the Workbook.Open method could throw exception when you try to
open a workbook that already opened. Excel display to use a message say "Do
you want to update.....". and if the user click No, Open method throw
exception with number. and I interested to see all possible error that the
open method could throw?

Regards,
Raja

"Gary Brown" wrote:

In your procedure's error handling, put something like...

Debug.Print err.number & " - " & Err.Description

or

Msgbox err.number & " - " & Err.Description

--
Hope this helps.
If it does, please click the Yes button.
Thanks in advance for your feedback.
Gary Brown



"Raja" wrote:

Hi,

where can I find the meaning of the error code that retun from the com interop

Regards,
Raja


Gary Brown[_5_]

Com Interop Errorcode
 
I don't know about a list of ONLY errors produced when opening a workbook but
the following procedure [ErrorList] will list all error messages that VBA
Excel throws. If a number is not listed, the Description is
'Application-defined or object-defined error'.

'/==============================================/
Public Sub ErrorList()
'create list of all errors with descriptions from
' Active Cell down
Dim i As Long, iMax As Long, x As Long
Dim varAnswer As Variant

On Error GoTo err_Sub

iMax = 5000

varAnswer = _
MsgBox("The process will list errors and descriptions." _
& vbCr & vbCr & "Any errors with the description " _
& vbCr & "'Application-defined or " & _
"object-defined error' will not be included in the list." _
& vbCr & vbCr & _
"All cells below the Active cell will be erased." & _
vbCr & vbCr & "Continue?", _
vbCritical + vbYesNo + vbDefaultButton2, _
"Create Error Listing...")

If varAnswer = vbYes Then
On Error Resume Next
ActiveCell.Offset(x, 0).value = "Err.Number"
ActiveCell.Offset(x, 1).value = "Err.Description"

For i = 1 To iMax
Err.Clear
Err.Raise i
If Len(Err.Description) < 0 And _
Err.Description < _
"Application-defined or object-defined error" Then
x = x + 1
ActiveCell.Offset(x, 0).value = Err.Number
ActiveCell.Offset(x, 1).value = Err.Description
End If
Err.Clear
Next i
End If

On Error GoTo err_Sub
Err.Clear

Cells.EntireColumn.AutoFit
ActiveCell.Offset(1, 0).Activate
ActiveWindow.FreezePanes = False
ActiveWindow.FreezePanes = True
ActiveWindow.Zoom = 75

exit_Sub:
Exit Sub

err_Sub:
GoTo exit_Sub
End Sub
'/==============================================/


--
Hope this helps.
If it does, please click the Yes button.
Thanks in advance for your feedback.
Gary Brown



"Raja" wrote:

Yes, I know that. I mean what the number means? where I can find a list
of all numbers?

For exmaple, the Workbook.Open method could throw exception when you try to
open a workbook that already opened. Excel display to use a message say "Do
you want to update.....". and if the user click No, Open method throw
exception with number. and I interested to see all possible error that the
open method could throw?

Regards,
Raja

"Gary Brown" wrote:

In your procedure's error handling, put something like...

Debug.Print err.number & " - " & Err.Description

or

Msgbox err.number & " - " & Err.Description

--
Hope this helps.
If it does, please click the Yes button.
Thanks in advance for your feedback.
Gary Brown



"Raja" wrote:

Hi,

where can I find the meaning of the error code that retun from the com interop

Regards,
Raja



All times are GMT +1. The time now is 11:33 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com