Import af externe data, fejler i ver 2002 men ok i 2007
Hejsa.Sidder og roder med at hente data ind fra vores AS400, det virker fint i version 2007, hvad mon jeg skal ændre for at det også virker i 2002
Får følgende fejl ... Object doesn't support this property or method
Her et brud af makroen
tb = "tbxxx"
With ActiveSheet.ListObjects.Add(SourceType:=0, Source:="ODBC;DSN=AS400 ;" _
, Destination:=Range("$A$1")).QueryTable
.CommandText = Array( _
"SELECT " & tb & ".TLTILGRP, " & tb & ".TLKØBP, " & tb & ".TLKØBL, " & tb & ".TLKØBC, " & tb & ".TLSALP, " & tb & ".TLSALL, " & tb & ".TLSALC, " & tb & ".TLVEKP, " & tb & ".TLKMOM, " & tb & ".TLCAVC, " & tb & ".T" _
, _
"LIKAS, " & tb & ".TLEANN, " & tb & ".TLARTNR, " & tb & ".TLPHØJ, " & tb & ".TLPOTS, " & tb & ".TLKSLA, " & tb & ".TLKSCT, " & tb & ".TLVATX, " & tb & ".TLUDBM, " & tb & ".TLTBM1, " & tb & ".TLTBM2, " & tb & ".TL" _
, _
"LEVN, " & tb & ".TLLVKS, " & tb & ".TLUBÅR, " & tb & ".TLUBUG, " & tb & ".TLUBLI, " & tb & ".TLSLAR, " & tb & ".TLSORT, " & tb & ".TLKAT, " & tb & ".TLEMKN, " & tb & ".TLEMKB, " & tb & ".TLLVVN, " & tb & ".TLALF" _
, _
"1, " & tb & ".TLALF2, " & tb & ".TLALF3, " & tb & ".TLLINK, " & tb & ".TLNYT, " & tb & ".TLMIN, " & tb & ".TLMAX, " & tb & ".TLLEVF, " & tb & ".TLTOLD, " & tb & ".TLVÆGT, " & tb & ".TLAFTP, " & tb & ".TLTILN, " _
, _
"" & tb & ".TLLINR, " & tb & ".THBESK" & Chr(13) & "" & Chr(10) & "FROM AS400DATA.FRAPCLIB." & tb & " " & tb & "" _
)
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.ListObject.DisplayName = "Tabel_Forespørgsel_fra_AS400"
.Refresh BackgroundQuery:=False
End With
Nogen der ka' hjælpe ...
Søren
