Quantcast
Channel: Für Entwickler: SQL Server Forum
Viewing all articles
Browse latest Browse all 1772

PowerPivot Data Source Path Dynamic Makro

$
0
0

Hallo togehter, (sry my english is bad)

i have a makro to create a sql connection like this:

I have the path in the workbook. Works well, but i need a way to change the connection to a PowerPivot Data Source , so i can use the data in Power View.

I don't find anythig in web.

The Date are in another excel file.

Hope for Help

friendly greets

Michi

Sub SQLDatenabfrageArchivTest()

Dim path As String

path = Tabelle1.Range("H64").Value
path2 = Tabelle1.Range("H65").Value


ActiveWorkbook.Connections("Test").Delete

    Workbooks("FC Automatic Test&FUD Analyse&Statistik.xlsm").Connections.Add _
        "Test", "", Array(Array( _
        "ODBC;DSN=Excel Files;DBQ=" & path & ";DefaultDir= " & path2 & ";DriverId=1046;MaxBufferSize=2048;PageTimeout=5;" _
        )), Array( _
        "SELECT `DatenTest$`.Asin, `DatenTest$`.Quantity, `DatenTest$`.Disposition, `DatenTest$`.Location, `DatenTest$`.`Outermost Location`, `DatenTest$`.`Location Type`, `DatenTest$`.`Audit Date`, `Da" _
        , _
        "tenTest$`.`Age (in days)`, `DatenTest$`.title, `DatenTest$`.Datum, `DatenTest$`.Realdate, `DatenTest$`.Realtitel, `DatenTest$`.alert, `DatenTest$`.Location2, `DatenTest$`.Owner, `DatenTest$`." _
        , _
        "Team, `DatenTest$`.Test_Days, `DatenTest$`.`Owner#`, `DatenTest$`.`Team#`, `DatenTest$`.`alert#`, `DatenTest$`.`Dropzonen#`, `DatenTest$`.alszahl, `DatenTest$`.TestDaysZahl, `DatenTest$`.`we" _
        , _
        "lche konsole`, `DatenTest$`.fuerStatistik, `DatenTest$`.Wochentag, `DatenTest$`.Schicht, `DatenTest$`.KW, `DatenTest$`.Monat, `DatenTest$`.Jahr" & Chr(13) & "" & Chr(10) & "FROM `DatenTest$` `DatenTest$`" _
        ), 2
       
End Sub


Viewing all articles
Browse latest Browse all 1772

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>