Eu le folosesc intr-o BD instalata pe un PC pe care nu am Office2007 si la care am dezactivat meniul specific Access 2007 (ribbon)
Functia de baza de export dintr-o BD Access este
Cod: Selectaţi tot
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "nume_tabel", "unde_export", True
Cod: Selectaţi tot
Sub ExportExcel()
Dim strOut As String
Dim tbl As AccessObject
Dim f As Boolean
'Deschide fereastra de dialog pentru selectarea locului unde doriti exportul
With Application.FileDialog(4) ' msoFileDialogFolderPicker
.Title = "Va rugam selectati folderul tinta"
If .Show Then
strOut = .SelectedItems(1)
If Not Right(strOut, 1) = "\" Then
strOut = strOut & "\"
End If
Else
MsgBox "Nu ati selectat nici un folder tinta.", vbExclamation
Exit Sub
End If
End With
f = (MsgBox("Doriti sa exportati toate tabelele in Excel?", _
vbQuestion + vbYesNo) = vbYes)
'Comanda pentru export
For Each tbl In CurrentData.AllTables
If Not tbl.Name Like "MSys*" And Not tbl.Name Like "~" Then
If f Then
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, _
' Transfera tabelele cu numele lor din BD a voastra
tbl.Name, strOut & tbl.Name & ".xlsx", True
Else
End If
End If
Next tbl
End Sub
Cod: Selectaţi tot
DoCmd.TransferSpreadsheet acImport, ........
Codul de mai jos este un exemplu de cod de import:
Cod: Selectaţi tot
DoCmd.TransferSpreadsheet _
acImport, _
acSpreadsheetTypeExcel5, _
"Table Name", _
Path & "Excel Data File.xls", _
True