Community
Hello everbody ;
I have like this form.
I want to save and update my form on d:\hsezenn.xls.
but when I try this. ı have same eror.
how can I save and update my data on d:\hsezenn.xls ?
Your going to have to show your code and where it's crashing.
There are lots of examples on the interwebs.
http://lmgtfy.com/?q=read+and+write+excel+vb.net
http://www.codeproject.com/Articles/32437/Read-and-Write-Excel-Files
Take a look ath this topic
Imports Microsoft.Office.Interop Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim oSheet As Excel.Worksheet Dim oXLApp As Excel.Application Dim wb As Excel.Workbook oXLApp = CreateObject("Excel.Application") wb = oXLApp.Workbooks.Open("d:\file.xls") oSheet = wb.ActiveSheet oXLApp.Visible = True oSheet.Cells(1, 1).Value = textbox1.text oSheet.Cells(1, 2).Value = TextBox2.Text oSheet.Cells(1, 3).Value = TextBox3.Text oSheet.Cells(1, 4).Value = TextBox4.Text wb.Save() End Sub End Class
when I do this code.
It doesnt work.
ı couldnt save my file.xls
how can I save my file.xls file ?
Try this code snip to save .xls file:
'Save workbook xlBook.SaveAs(FileName, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, _ Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing) xlApp.Workbooks.Close() xlApp.Quit() 'or ' xlApp.Windows[1].Close(false, Type.Missing, Type.Missing);
Can't find what you're looking for? Ask the community or share your knowledge.