Vb.net : Interop exception when showAllData() on Excel sheet?

I have some filters applied on my input excel sheets, so I decided to remove them using showAllData() method in vb.net.

MSDN Reference : http://msdn.microsoft.com/en-us/library/bb178108(v=office.12).aspx

But it is giving a very strange exception on that line : Exception from HRESULT: 0x800A03EC

My code :

sh = myWorkBook.Sheets(2)
' sh is my sheet
sh.Visible = True
sh.Activate()
sh.Select()
sh.ShowAllData()     ' Exception raised on this line

What am I doing wrong ?

What is this exception, I have seen this a lot lately. But its never clear what went wrong ?

Answers


Got it fixed :

The sheets that I was using for input didn't had filtered data when tested.

So, here goes the code change :

sh = myWorkBook.Sheets(2)
' sh is my sheet
sh.Visible = True
sh.Activate()
sh.Select()
If sh.FilterMode = True Then
    sh.ShowAllData()
End If

The extra if, solved the issue.

But still the raised exception was not at all helpful. Explain the exception if someone can.


Need Your Help

symfony 2 equivalent for url_for() function in symfony 1

javascript ajax jquery symfony2

In Symfony 1 we can access an action in template page as for example url_for('modulename/actionname') without writing anything in routing.yml.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.