OLEDBConnection.Connection (Excel)

Returns or sets a string that contains OLE DB settings that enable Microsoft Excel to connect to an OLE DB data source.

Setting the Connection property does not immediately initiate the connection to the data source. You must use the Refresh method to make the connection and retrieve the data. When using an offline cube file, set the UseLocalConnection property to True and use the LocalConnection property instead of the Connection property.


ActiveWorkbook.Connections(1).OLEDBConnection.Connection = "OLEDB;Provider=MSOLAP;Location=srvdata;Initial Catalog=National"