keky

SNUS - create MS Excel file

Nov 11th, 2015
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Dim oExcel As Object
  2. Dim oBook As Object
  3. Dim oSheet As Object
  4.  
  5. Private Sub ExcelButton_Click()
  6.  
  7.     'Start a new workbook in Excel
  8.     Set oExcel = CreateObject("Excel.Application")
  9.     oExcel.Visible = True
  10.     Set oBook = oExcel.Workbooks.Add
  11.  
  12.     'Add data to cells of the first worksheet in the new workbook
  13.     Set oSheet = oBook.Worksheets(1)
  14.     oSheet.Range("A1").Value = "Nivo rezervoara"
  15.     oSheet.Range("B1").Value = Fix32.Fix.NIVO_REZERVOARA.F_CV
  16.  
  17.     'Save the Workbook and quit Excel
  18.     oBook.SaveAs "C:\test_01.xls"
  19.    
  20.     oExcel.Quit
  21. End Sub
Advertisement
Add Comment
Please, Sign In to add comment