Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 718
Default Try Catch errors locking Excel

Environment...
Visual Studio 2005
VSTO 2005 SE
MS Office 2003 Professional (SP3)

So here's the thing. We had some old OBA's over Excel that we updated from
..net 1.1 to .net 2.0. In the update, we found that the "ThisWorkbook" class
was moved to a new class file, and the new "ThisWorkbook" class for VSTO 2005
over .Net 2.0 was implemented. The previous "ThisWorkbook" class was named
"OldWorkbook" or something to that effect and with in the new
"ThisWorkbook"'s Open event event, "OldWorkbook" as instantiated and brought
up.

Now our Excel OBA has an action where it has to make remote calls to a web
service and retrieve some data. I'm finding that my Catch portions of my Try
Catch Finally block are, in a way, being skipped. It's freakishly odd.

Example:

Public Class OldWorkBook

Public Sub ReadSomeData(byval args() as object)
Dim myData As String = "My Starting."
Try

'Here is where i use a controller object (MyController = Global Var)
'and call the webservice expecting to get some data back.
myData = MyController.CallWebService(args)

Catch mySoap As SoapException
messagebox.show(mysoap.message)
messagebox.show(mysoap.tostring)
Catch myError As Exception
messagebox.show(myError.message)
messagebox.show(myError.tostring)
Finally
'and I do some clean up, for example
myData = nothing
End Try

End Class

The problem here is that the Messagebox.Show calls in my Catches only some
times get called. Other times, the Messagebox.show calls don't seem to get
hit at all. However the Finally block always gets hit. MyData will always
come back as nothing.

I've even tried to declare exception variables outside of the Try Catch
statement, and set them with in the catch blocks. But for some reason even
those variables don't get populated on exception. I'm at a complete loss
here.

Other example
dim MyOuterEx as Exception
dim MyOuterSoapEx as SoapException
Try

'Here is where i use a controller object (MyController = Global Var)
'and call the webservice expecting to get some data back.
myData = MyController.CallWebService(args)

Catch mySoap As SoapException
myOuterSoapEx = mySoap
messagebox.show(mysoap.message)
messagebox.show(mysoap.tostring)
Catch myError As Exception
myOuterEx = myError
messagebox.show(myError.message)
messagebox.show(myError.tostring)
Finally
'and I do some clean up, for example
'myOuter exception variables are nothing even though an exception has occured.
myData = nothing
End Try

I know that an exception is occuring because "Sometimes" I get the
messagebox.show calls to fire and show me an error. But even then "myOuter"
exceptions aren't getting populated.

Other Symptoms:

Excel it self does a kind of partial lock up. Nothing in excel is usable
until I change my active screen to another application then back to excel
again

The MessageBox.Show calls get shown out of order every other attempt to run
this procedure.

If I put the Try Catch statement into the CallWebService call of my
Controller class, the messagebox calls show exactly correct every time and I
get no issue with Excel. However this breaks the MVC pattern that my company
tries to adhere to.

Any suggestions here would be great.
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 718
Default Try Catch errors locking Excel

Just to add to this, the issue, after further research points to an issue
where I simply can't reliably pass back an exception from a controller class.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to catch data from a EXCEL file jokobe Excel Discussion (Misc queries) 0 April 21st 08 07:43 PM
Excel Throwing Circular Errors When No Errors Exist MDW Excel Worksheet Functions 1 August 10th 06 02:15 PM
how to catch errors from outlook helpwithXL Excel Programming 1 April 14th 05 05:26 PM
Catch drop event in excel Edi Excel Programming 1 February 20th 05 05:26 PM
How to catch Drag-and-drop in Excel 97? andrewLLL Excel Programming 1 October 12th 04 10:42 AM


All times are GMT +1. The time now is 01:38 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"