Hey there,
I have an excel PowerPivot report that I'm attempting to refresh on open. I understand that i can use
ActiveWorkBook.Model.Refresh but i am prompted for password to my Oracle data connection.
Is there a way to hardcode my pswd establish the connection and then refresh the data model thereafter using an OnOpen VBA macro.
I have an excel PowerPivot report that I'm attempting to refresh on open. I understand that i can use
ActiveWorkBook.Model.Refresh but i am prompted for password to my Oracle data connection.
Is there a way to hardcode my pswd establish the connection and then refresh the data model thereafter using an OnOpen VBA macro.
Code:
Private Sub Workbook_Open()
Dim conn As New ADODB.Connection
Set conn = New ADODB.Connection
connStr = "Provider=OraOLEDB.Oracle;Data Source=DB111.MyServer.COM;User ID=NAME;Password=MyPSWD01;"
conn.Open connStr, NAME, MyPSWD01
RefreshPP
End Sub
Private Sub RefreshPP()
ActiveWorkbook.Model.Refresh
End Sub