.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how can I read and write on excel ?

4 REPLIES 4
Reply
Message 1 of 5
h.sezenn
415 Views, 4 Replies

how can I read and write on excel ?

28-03-13-q1.jpg

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 ?

_____________________________________________________________________________________
Everything For Duct
4 REPLIES 4
Message 2 of 5
arcticad
in reply to: h.sezenn

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

 

---------------------------



(defun botsbuildbots() (botsbuildbots))
Message 3 of 5
Hallex
in reply to: h.sezenn

Take a look ath this topic

http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Names-and-coordinates-in-excel-placin...

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Message 4 of 5
h.sezenn
in reply to: h.sezenn

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 ?

 

_____________________________________________________________________________________
Everything For Duct
Message 5 of 5
Hallex
in reply to: h.sezenn

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);

 

_____________________________________
C6309D9E0751D165D0934D0621DFF27919

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost