Reputation: 405
when i set Excel apllications displayalert propery to true this exception is fired... why?
Upvotes: 4
Views: 13176
Reputation: 91
the vb.net code, loop and retry until range.value is accepted to system.array
Dim xlApp As Excel.Application = New Excel.Application
Dim wb As Excel.Workbook = xlApp.Workbooks.Open(paths)
Dim ws As Excel.Worksheet=wb.Worksheets(1)
Dim range As Excel.Range = Nothing
range = ws.UsedRange
Dim wh As System.Array
Dim retryRange As Boolean = False
While retryRange
Try
wh = range.Value(Excel.XlRangeValueDataType.xlRangeValueDefault)
retryRange = False
Catch ex As Exception
retryRange = True
End Try
End While
vb,net code for richj answer
Upvotes: 1
Reputation: 7529
Is the property browser suspended? If so, this might help: HRESULT 800ac472 from set operations in Excel
One suggestion is to put your call inside a try block inside a loop, and keep trying the call until it succeeds. It might look something like this:
retry = True
Do
Try
'Put your call here.
retry = False
Catch ex As Exception
'Need to try again,
'If this isn't the 0x800ac472 exception it should be re-thrown,
'Use Sleep(50) to reduce the number of retries,
'Use Exit Do or re-throw the exception to give up.
End Try
While retry
I don't write in VB myself, so apologies for any mistakes.
Upvotes: 4