標題:
求QueryTables 要如何滙入其他的 excel 檔案
[打印本頁]
作者:
sghsgh1111
時間:
2015-3-4 00:54
標題:
求QueryTables 要如何滙入其他的 excel 檔案
這是錄置巨集所產生的程式碼, 但不了解這個語法, 有高手可以解答嗎
這個巨集可以再簡化嗎
With ActiveSheet.QueryTables.Add(Connection:=Array( _
"OLEDB;Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data Source=I:\VBA.xls;Mode=Share Deny Write;Extended Prop" _
, _
"erties=""HDR=YES;"";Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet OLEDB:Database Password="""";Jet OLEDB:Engine Type=3" _
, _
"5;Jet OLEDB:Database Locking Mode=0;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Datab" _
, _
"ase Password="""";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=F" _
, "alse;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False"), _
Destination:=Range("A2"))
.CommandType = xlCmdTable
.CommandText = Array("Status$")
.Name = "VBA_1"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.SourceDataFile = "I:\VBA.xls"
.Refresh BackgroundQuery:=False
End With
歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)