home *** CD-ROM | disk | FTP | other *** search
- Attribute VB_Name = "Module1"
- Sub Makro1()
- Attribute Makro1.VB_Description = "Makro zaznamenanΘ 13.4.2001, Pokorn²"
- Attribute Makro1.VB_ProcData.VB_Invoke_Func = " \n14"
- '
- ' Makro1 Makro
- ' Makro zaznamenanΘ 13.4.2001, Pokorn²
- '
- With ActiveSheet.QueryTables.Add(Connection:= _
- "ODBC;DRIVER=SQL Server;SERVER=(local);UID=sa;PWD=;WSID=X8J5U8;DATABASE=Northwind" _
- , Destination:=Range("A11"))
- .CommandText = Array( _
- "SELECT Customers.CustomerID, Customers.CompanyName, Customers.Address, Customers.City, Customers.Country, Orders.OrderID, Orders.OrderDate, Orders.Freight" & Chr(13) & "" & Chr(10) & "FROM Northwind.dbo.Customers Customers, Nort" _
- , _
- "hwind.dbo.Orders Orders" & Chr(13) & "" & Chr(10) & "WHERE Customers.CustomerID = Orders.CustomerID AND ((Customers.Country='USA') OR (Customers.Country='Canada') OR (Customers.Country='Mexico'))" & Chr(13) & "" & Chr(10) & "ORDER BY Customers.CompanyName" _
- )
- .Name = "Dotaz z SQL Server"
- .FieldNames = True
- .RowNumbers = False
- .FillAdjacentFormulas = False
- .PreserveFormatting = True
- .RefreshOnFileOpen = False
- .BackgroundQuery = True
- .RefreshStyle = xlInsertDeleteCells
- .SavePassword = True
- .SaveData = True
- .AdjustColumnWidth = True
- .RefreshPeriod = 0
- .PreserveColumnInfo = True
- .Refresh BackgroundQuery:=False
- End With
-
- End Sub
-