export excel depuis fichier mdb
Bonjour à tous,
je vous écris car j'ai un soucis je dois faire un export d'un fichier mdb vers excel :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| Dim xlApp As Excel.Application
Try
xlApp = GetObject(, "excel.application")
Catch
xlApp = New Excel.Application
Finally
xlApp.Visible = False
End Try
'ajout d'une page et sélection
Dim SheetExcel As Excel.Worksheet = xlApp.Workbooks.Add.ActiveSheet
'requete serveur
Dim path As String = My.Application.Info.DirectoryPath
With SheetExcel.QueryTables.Add(Connection:= _
"OLEDB;Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & path & "\" & IDEA.fichier & ";Jet OLEDB:Database Password=" & IDEA.mdp, Destination:=SheetExcel.Range("A1"))
.CommandText = "select * from toto"
.Name = "version"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = Excel.XlCellInsertionMode.xlOverwriteCells
.SavePassword = False
.SaveData = False
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh(BackgroundQuery:=False)
End With |
Donc cela fonctionne bien quand j'ai access d'installé sur le poste hors je dois l'installer sur des postes qui n'ont pas access et la ca coince.
Je sais qu'il est possible de lire une base access sans avoir besoin d'access ( mon logiciel le fait) mais dès qu'il s'agit de faire l'export ca foire.
quelqu'un a une idée?