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

connessione access 2000

Tra i riferimenti inserire microsoft DAO 3.6




Option Explicit

dim dbArchivio As Database
dim rsTabellA As DAO.Recordset

Dim nomedatabase As String
Dim nometabella As String


Private Sub Form_Load()

  nomedatabase = "aaaaaaaa.mdb"
   nometabella = "bbbbbb"

  Set dbArchivio = DBEngine(0).OpenDatabase(nomedatabase)
  Set rsTabellA = dbArchivio.OpenRecordset(nometabella)

End Sub