Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
msgbox worksheets("SheetName").Querytables(1).connection
worksheets("SheetName").Querytables(1).connection = "This is the new connection string"
.Connection = "OLAP;DSN=[COLOR=red]DatabaseType[/color];DBQ=
[COLOR=red]Path:\To\Location\Of\Cube\And\CubeName
[/color];DefaultDir=[COLOR=red]Path:\To\Location\Of\Cube
[/color];DriverId=790;MaxBufferSize=2048;PageTimeout=5;"
myPath = Thisworkbook.path
myFileName = "OLAP Cube Name + Extension"
.Connection = "OLAP;DSN=[COLOR=red]DatabaseType
[/color];DBQ=" & myPath & "\" & myFileName & ";
DefaultDir=" & myPath & ";DriverId=790;MaxBufferSize=2048;PageTimeout=5;"
QueryType=OLEDB
Version=1
CommandType=Cube
Connection=Provider=MSOLAP.2;Data Source=D:\OLAP\OLAP_SALES_SALES_ALL.cub;Initial Catalog=SALES_ALL;Client Cache Size=25;Auto Synch Period=10000
CommandText=SALES_ALL
Private Sub Workbook_Open()
Dim i As Integer
i = 1
Rem With ActiveWorkbook.PivotCaches(1)
For Each pc In ActiveWorkbook.PivotCaches
With ActiveWorkbook.PivotCaches(i)
.LocalConnection = _
"OLEDB;Provider=MSOLAP.2;Data Source=D:\OLAP\OLAP_SALES_SALES_ALL.cub"
.UseLocalConnection = True
pc.RefreshOnFileOpen = True
End With
Rem End With
i = i + 1
Next
End Sub
Private Sub Workbook_Open()
For Each pc In ActiveWorkbook.PivotCaches
With pc
.LocalConnection = _
"OLEDB;Provider=MSOLAP.2;Data Source=D:\OLAP\OLAP_SALES_SALES_ALL.cub"
.UseLocalConnection = True
.RefreshOnFileOpen = True
End With
Next
End Sub