.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> File Operation >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Create Excel in Run Time in VB.NET

Posted By:Santosh       Posted Date: November 10, 2009    Points: 10    Category: File Operation    URL: http://www.dotnetspark.com  
 

Below Code will Help you to Create Excel Sheet in Run Time in VB.NET.

Code

       Dim xlApp As Excel.Application
        Dim xlWorkBook As Excel.Workbook
        Dim xlWorkSheet As Excel.Worksheet
        Dim range As Excel.Range
        Dim misValue As Object = System.Reflection.Missing.Value
        xlApp = New Excel.ApplicationClass
        xlWorkBook = xlApp.Workbooks.Add(misValue)
        xlWorkSheet = xlWorkBook.Sheets("sheet1")
        xlWorkSheet.Cells.Font.ColorIndex = 3
        xlWorkSheet.Cells.Font.Bold = True
        xlWorkSheet.Cells(2, 1) = "Screen Name"    'Report Header
        xlWorkSheet.Cells(2, 2) = "Error Description" 'Report Header

        xlWorkSheet.Cells(2, 3) = "Developer Name" 'Report Header
        xlWorkSheet.Cells(2, 4) = "Tester Name"    'Report Header
        xlWorkSheet.Cells(2, 5) = "Tester Name"      'Report Header
        xlWorkSheet.Cells(1, 5) = "Creating Excel Sheet"
        range = xlWorkSheet.Range("b1", " e1")
        range.Merge()
        xlApp.Visible = True





Regards
Santosh


     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend