Facebook
From Chocolate Dolphin, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 166
  1.     Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
  2.         Dim objExcel As New Excel.Application
  3.         Dim objZeszyt As Excel.Workbook
  4.         Dim objArkusz As Excel.Worksheet
  5.         Dim nowyplik As String
  6.  
  7.  
  8.         objExcel = CreateObject("Excel.Application")
  9.  
  10.         nowyplik = "C:\AK\BOSH\swieca2.xlsx"
  11.         objZeszyt = objExcel.Workbooks.Add()
  12.         objArkusz = objZeszyt.ActiveSheet
  13.  
  14.         objArkusz.Cells(3, 2).Value = CSng(txtSrednica.Text)
  15.         objArkusz.Cells(3, 3).Value = CSng(txtDlugosc.Text)
  16.         objArkusz.Cells(3, 4).Value = CSng(txtRozmiar.Text)
  17.         objArkusz.Cells(3, 5).Value = CSng(txtLiczba.Text)
  18.  
  19.         objZeszyt.Close()
  20.         objExcel.Quit()
  21.         objArkusz = Nothing
  22.         objZeszyt = Nothing
  23.         objExcel = Nothing
  24.         MsgBox("Program zakończył zapis do Excela")
  25.     End Sub