470,849 Members | 1,109 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,849 developers. It's quick & easy.

Excel worksheet

Hello all,

Am not sure if this is the right newgroup.

I want to open and excel worksheet from VB.Net, populate data and save it.

Any idea how it can be done?

Thanks in advance
Regards
Ishan
Mar 6 '06 #1
1 1294
Dim xlApp As Excel.Application
Dim xlWB As Excel.Workbook
Dim xlWS As Excel.Worksheet

Dim inVal As Object

'Create Report Name for this month
Dim sRept As String = "fullpath to sheet..XLS"

'Open the report template
inVal = New System.Runtime.InteropServices.DispatchWrapper(Not hing)
xlApp = CType(CreateObject("Excel.Application"), Excel.Application)
xlApp.Visible = False 'True if you want to see it on the screen
xlWB = xlApp.Workbooks.Open(sRept )
xlWS = CType(xlWB.Sheets(1), Excel.Worksheet)
xlWS.PageSetup.RightHeader = "Last Updated: " & Format(Today, "dd-MMM-yy")

Dim nCol, nRow as Integer
'To save word Data in cell B3
nRow = 3
nCol = 2

xlWS.Cells(nRow, nCol) = "Data"

'Save & Close the Excel Sheet
xlWB.Close(SaveChanges:=True)
xlApp.Visible = True
xlApp.Quit()
System.Runtime.InteropServices.Marshal.ReleaseComO bject(xlApp)

"Ishan Bhalla" wrote:
Hello all,

Am not sure if this is the right newgroup.

I want to open and excel worksheet from VB.Net, populate data and save it.

Any idea how it can be done?

Thanks in advance
Regards
Ishan

Mar 7 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by Allison Bailey | last post: by
1 post views Thread by c duden | last post: by
1 post views Thread by mail2atulmehta | last post: by
reply views Thread by dgoel | last post: by
14 posts views Thread by pmud | last post: by
8 posts views Thread by Sam | last post: by
1 post views Thread by Randall Arnold | last post: by
6 posts views Thread by gumbystation | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.