Hat sich nie einer drum gekümmert. Das folgende Makro zeigt die Quelle der Pivottabelle am Zellcursor an:
Sub Show_PivotSource()
REM report database source of pivot table having the cell cursor
Dim oSel, sh, pv, pvc%, i%, p, oImportDescriptor()
Dim sDBName$, sSource$, iType%, bNative As Boolean,sDrvURL$
Dim sMsg$, sType$
oSel = ThisComponent.getCurrentSelection()
sh = oSel.getSpreadSheet()
pvc = sh.DataPilotTables.getCount()
for i = 0 to pvc -1
pv = sh.DataPilotTables.getByIndex(i)
if oSel.queryIntersection(pv.getOutputRange).getCount()>0 then exit for
next
if i >= pvc then exit sub
REM com.sun.star.sheet.DatabaseImportDescriptor
oImportDescriptor= pv.ImportDescriptor()
for each p in oImportDescriptor()
if p.Name = "DatabaseName" then
sDBName = p.Value
elseif p.Name = "SourceType" then
iType = p.Value
elseif p.Name = "IsNative" then
bNative = p.Value
elseif p.Name = "SourceObject" then
sSource = p.Value
elseif p.Name = "ConnectionResource" then
sDrvURL = p.Value
endif
next
if iType = com.sun.star.sheet.DataImportMode.TABLE then
sType = "Table or View"
elseif iType = com.sun.star.sheet.DataImportMode.SQL then
if bNative then
sType = "Native SELECT"
else
sType = "Parsed SELECT"
endif
elseif iType = com.sun.star.sheet.DataImportMode.QUERY then
sType = "Query"
elseif iType = com.sun.star.sheet.DataImportMode.NONE then
sType = "NO_IMPORT"
end if
sMsg = "DB Name = "& sDBName _
& Chr(10)& "Source Type = "& sType _
& Chr(10) & "Source: " & sSource _
& Chr(10) & "Connection Ressource = "& sDrvURL
Msgbox sMsg, "Database Source of Pivot """& pv.getName()
End Sub