excel ile vb arasında yardım

Kodla Büyü

agamuratcelebi

Seçkin Üye
Seçkin Üye
Mesajlar
906
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
Dim i As Integer


'Start a new workbook in Excel.
oExcel = CreateObject("Excel.Application")
oBook = oExcel.Workbooks.Add

'Add data to cells of the first worksheet in the new workbook.
oSheet = oBook.Worksheets(1)
oSheet.Range("A1").Value = "Last Name"
oSheet.Range("B1").Value = "First Name"
oSheet.Range("A1:B1").Font.Bold = True
oSheet.Range("A2").Value = "Murat"
oSheet.Range("B2").Value = "Çelebioğlu"

For i = 1 To ListBox1.Items.Count
oSheet.Range("A" & i).Value = ListBox1.Items.Item(i - 1)
Next


'Save the Workbook and quit Excel.
oBook.SaveAS("murat.xls")
oSheet = Nothing
oBook = Nothing
oExcel.Quit()
oExcel = Nothing
GC.Collect()

arkadaşlar yukarıdaki kodla yeni bir excel sayfasına verileri yazabiliyorym fakat ben kayıtlı bir excel dosyasını açmak istiyorum eski bilgileride silmesini engellemek istiyorum bunu nasıl yaparım
 
arkadaşlar bu kod olmazsa bana excel dosyasını açıp listboxdakileri bilgileri excele dosyaya atmak için gerekli program varmı elinizde arkadaşlar çok lazım visual baicte visual studio 2008 kullanıyorum yukarıdaki kot yeni bir excel sayfası açıyor
 
BBNET
Geri
Üst