iknowu99
Well-known Member
- Joined
- Dec 26, 2004
- Messages
- 1,158
Hi all,
I'm trying to get the following to work..except I cant understand whether this is info stored locally on my PC or is it getting new data every time from the Database?
I'm trying to get the following to work..except I cant understand whether this is info stored locally on my PC or is it getting new data every time from the Database?
Code:
Sub Macro2()
With ActiveSheet.ListObjects.Add(SourceType:=0, Source:=Array( _
"OLEDB;Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=True;Data Source=mkt-db;Use Procedure for Prepare=1;Auto " _
, _
"Translate=True;Packet Size=4096;Workstation ID=40-02;Use Encryption for Data=False;Tag with column collation when possible" _
, "=False;Initial Catalog=Marketing"), Destination:=Sheets("Sheet1").Range("$A$1")).QueryTable
.CommandType = xlCmdTable
.CommandText = Array("""Marketing"".""dbo"".""03""")
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.SourceConnectionFile = _
"C:\Documents and Settings\m\My Documents\My Data Sources\Marketing.odc"
.ListObject.DisplayName = "Table_Marketing_1"
.Refresh BackgroundQuery:=False
End With
End Sub