Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 18th, 2008, 06:33 AM
Registered User
Join Date: Feb 2008
Location: Delhi, , India.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Exception from HRESULT: 0x800A03EC

Hi friend plz help me

i m putting data from a dataset to an excel file in windows application.

after setting value of 2 cells
i m getting this error : Exception from HRESULT: 0x800A03EC

the code is

Dim MyExcel As New Microsoft.Office.Interop.Excel.Application
            MyExcel.Workbooks.Open(Application.StartupPath() & "\Preview\WorkSheet1.xls")
        Catch ex As Exception
            MsgBox("Open : " & ex.Message)
            MyExcel = Nothing
        End Try

        MyExcel.ActiveWorkbook.ActiveSheet.Cells(5, 1) = ("Party Ledger for Party " & ds.Tables(0).Rows(0).Item("PartyName"))
        MyExcel.ActiveWorkbook.ActiveSheet.Cells(6, 1) = ("From " & CDate(ds.Tables(0).Rows(0).Item("Date")).Date & " To " & CDate(ds.Tables(0).Rows(ds.Tables(0).Rows.Count - 1).Item("Date")).Date)

        Dim rows As Integer = 8
        Dim TotalDr As Decimal = 0
        Dim TotalCr As Decimal = 0
        For i As Integer = 0 To ds.Tables(0).Rows.Count - 1
            MyExcel.ActiveWorkbook.ActiveSheet.Cells(8 + i, 0) = i + 1
' getting error here
      MyExcel.ActiveWorkbook.ActiveSheet.Cells(8 + i, 1) = ds.Tables(0).Rows(i).Item("Description")
            MyExcel.ActiveWorkbook.ActiveSheet.Cells(8 + i, 2) = ds.Tables(0).Rows(i).Item("Date")
            If ds.Tables(0).Rows(i).Item("Type") = "Sales" Or ds.Tables(0).Rows(i).Item("Type") = "Issue" Then
                MyExcel.ActiveWorkbook.ActiveSheet.Cells(8 + i, 3) = CDbl(ds.Tables(0).Rows(i).Item("Ammount"))
                TotalDr = totaldr + CDbl(ds.Tables(0).Rows(i).Item("Ammount"))
                MyExcel.ActiveWorkbook.ActiveSheet.Cells(8 + i, 3) = ""
            End If
            If ds.Tables(0).Rows(i).Item("Type") = "Purchase" Or ds.Tables(0).Rows(i).Item("Type") = "Receive" Then
                MyExcel.ActiveWorkbook.ActiveSheet.Cells(8 + i, 4) = CDbl(ds.Tables(0).Rows(i).Item("Ammount"))
                TotalCr = TotalCr + CDbl(ds.Tables(0).Rows(i).Item("Ammount"))
                MyExcel.ActiveWorkbook.ActiveSheet.Cells(8 + i, 4) = ""
            End If
            If ds.Tables(0).Rows(i).Item("ClosingBalance") < 0 Then
                MyExcel.ActiveWorkbook.ActiveSheet.Cells(8 + i, 5) = ds.Tables(0).Rows(i).Item("ClosingBalance") & " Cr"
            ElseIf ds.Tables(0).Rows(i).Item("ClosingBalance") > 0 Then
                MyExcel.ActiveWorkbook.ActiveSheet.Cells(8 + i, 5) = ds.Tables(0).Rows(i).Item("ClosingBalance") & " Dr"
            End If
            rows = rows + i
        Dim fpath As String
            fpath = Application.StartupPath() & "WorkSheet1" & Date.Today.Day * Date.Today.Second & "" & ds.Tables(0).Rows(0).Item("PartyName") & ".xls"
            MsgBox("File Saved successfully")
        Catch ex As Exception
            MsgBox("Problem occur during saving report, Please Try Again.")
            MyExcel = Nothing
            MyExcel.ActiveWorkbook.Close(False, Application.StartupPath() & "\Preview\SuccessRateByPayer.xls")
            MyExcel.DisplayAlerts = False
            MyExcel = Nothing
        End Try

    End Sub

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Error 'Exception from HRESULT: 0x800A03EC' vipin_pc ASP.NET 2.0 Professional 3 November 6th, 2009 09:17 AM
Needhelp Error- Exception from HRESULT: 0x800A0057 remya1000 General .NET 1 November 6th, 2008 11:45 AM
access denied. [exception from HRESULT: 0x80070005 p2ptolu Internet Information Services 0 December 18th, 2007 02:58 PM
Exception from HRESULT : 0x800A2740. remya1000 .NET Framework 1.x 0 November 8th, 2007 04:29 PM
Exception from HRESULT: 0x80131524. kschori Crystal Reports 0 May 7th, 2004 03:27 PM

All times are GMT -4. The time now is 12:33 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.