giovedì 16 aprile 2015

vb6 aprire un file excel esistente (nuovo o esistente)


Option Explicit

'variabili per excel
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
Dim nomefile As String



Private Sub cmdApriFileExcel_Click()

  'inizializza nomefile
  nomefile = App.Path & "xxxxx_.xls"
  'Start a new workbook in Excel
  Set oExcel = CreateObject("Excel.Application")
  Set oBook = oExcel.Workbooks.Open(nomefile)
 
End Sub

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

End Sub

Nessun commento:

Posta un commento