PDA

View Full Version : Solved: view all exceptions



Bogdan0x400
10-28-2011, 02:13 AM
I have a VSTO Excel 2010 workbook project, and it works on all PCs except one. The additional custom user control isn't present on the workbook. I've noticed that exceptions in C# are suppressed, and I haven't found where they can be viewed. Is there such thing as Excel error log? How do I turn on all error messages?

Kenneth Hobs
10-28-2011, 11:58 AM
In VBA, you need an "On Error Goto SomeLabelNameOrNumber" to show error details. Here is how I would do it in VBA.
Sub TestErrorRoutine()
Dim x As Integer, Msg As String
On Error GoTo ErrMsg

x = 1 / 0

GoTo EndNow
ErrMsg:
If Err.Number <> 0 Then
Msg = "Error # " & Str(Err.Number) & " was generated by " _
& Err.Source & Chr(13) & Err.Description
MsgBox Msg, , "Error", Err.HelpFile, Err.HelpContext
Exit Sub
End If
EndNow:
End Sub

Bogdan0x400
11-02-2011, 08:40 AM
I don't use VBA, I use C#.

Kenneth Hobs
11-02-2011, 04:10 PM
Since this is a VBA forum, then it is not appropriate to discuss C#. I have often found that if I know one language solution, the other language solution will be similar. I don't know of any sites that discuss Excel using C# that have a large user group. More likely you will have to search through standard C# forums.

While VSTO might be the future, my guess is that most do not use it. I normally use vb.net when working with Microsoft Visual Studio 2010 Express. Chip Pearson has some information about Excel with VSTO and vb.net and some C#. http://www.cpearson.com