G
Gazz_85
I have written some code to import a data table from another document, but
not all the information is being pulled across:
the code is below:
Sub PODT_Report_Import()
'
' PODT_Report_Import Macro
' Macro recorded 19/08/2009 by gsmart
'
'
Sheets("PODT Import").Select
Cells.Select
Range("A2522").Activate
Selection.ClearContents
Range("A1").Select
With ActiveSheet.QueryTables.Add(Connection:=Array( _
"OLEDB;Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User
ID=Admin;Data Source=\\sladmc01\Data\Users_Shared\Stores\1 Procurement
2009\Purchase Orders\PODT Report\PODT Repor" _
, _
"t.xls;Mode=Share Deny Write;Extended Properties=""HDR=YES;"";Jet
OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet OLEDBat" _
, _
"abase Password="""";Jet OLEDB:Engine Type=35;Jet OLEDBatabase
Locking Mode=0;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Globa" _
, _
"l Bulk Transactions=1;Jet OLEDB:New Database Password="""";Jet
OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False" _
, _
";Jet OLEDBon't Copy Locale on Compact=False;Jet OLEDB:Compact
Without Replica Repair=False;Jet OLEDB:SFP=False" _
), Destination:=Range("A1"))
.CommandType = xlCmdTable
.CommandText = Array("Sheet1$")
.Name = "PODT Import"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.SourceDataFile = _
"\\sladmc01\Data\Users_Shared\Stores\1 Procurement 2009\Purchase
Orders\PODT Report\PODT Report.xls"
.Refresh BackgroundQuery:=False
Sheets("PO Status").Select
End With
End Sub
any help?????
not all the information is being pulled across:
the code is below:
Sub PODT_Report_Import()
'
' PODT_Report_Import Macro
' Macro recorded 19/08/2009 by gsmart
'
'
Sheets("PODT Import").Select
Cells.Select
Range("A2522").Activate
Selection.ClearContents
Range("A1").Select
With ActiveSheet.QueryTables.Add(Connection:=Array( _
"OLEDB;Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User
ID=Admin;Data Source=\\sladmc01\Data\Users_Shared\Stores\1 Procurement
2009\Purchase Orders\PODT Report\PODT Repor" _
, _
"t.xls;Mode=Share Deny Write;Extended Properties=""HDR=YES;"";Jet
OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet OLEDBat" _
, _
"abase Password="""";Jet OLEDB:Engine Type=35;Jet OLEDBatabase
Locking Mode=0;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Globa" _
, _
"l Bulk Transactions=1;Jet OLEDB:New Database Password="""";Jet
OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False" _
, _
";Jet OLEDBon't Copy Locale on Compact=False;Jet OLEDB:Compact
Without Replica Repair=False;Jet OLEDB:SFP=False" _
), Destination:=Range("A1"))
.CommandType = xlCmdTable
.CommandText = Array("Sheet1$")
.Name = "PODT Import"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.SourceDataFile = _
"\\sladmc01\Data\Users_Shared\Stores\1 Procurement 2009\Purchase
Orders\PODT Report\PODT Report.xls"
.Refresh BackgroundQuery:=False
Sheets("PO Status").Select
End With
End Sub
any help?????