sql

S

susie

With ThisWorkbook.Worksheets("Estimate").QueryTables.Add
(Connection:= _
"ODBC;DRIVER=SQL
Server;SERVER=servername;UID=yourloginid;APP=Microsoft®
Query;WSID=servername;DATABASE=yourdatabasename;Trusted_Con
nection=Yes" _
, Destination:=ThisWorkbook.Worksheets
("Estimate").Range("c7"))
.CommandText = Array( _
"SELECT * FROM Quote")
.Name = "Can be any name"
.FieldNames = False
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlOverwriteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top