Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
1924to1928
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

Pivot in Userform

Pivot in Userform
29.03.2023 11:14:27
Leo

Hallo zusammen,

ich habe im Netz schon nach einer Lösung gesucht aber nicht wirklich etwas gefunden. Deshalb weiß ich auch nicht ob das möglich ist.

Kann man irgendwie eine Pivot Tabelle auf einer Userform darstellen? Oder geht das gar nicht?

4
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Pivot in Userform
29.03.2023 12:19:01
volti
Hallo Leo,

ich glaube nicht, dass man eine Pivot in einer Userform anzeigen lassen kann. Da müsste es schon ein entsprechendes Active-X-Objekt geben.
Ich denke auch, dass Userformen hierfür nicht sinnvoll sind.

Aber Du könntest bei Bedarf einen Bildausschnitt der Pivot vom Bildschirm in eine UF in ein ImageControl bringen. Vielleicht reicht Dir das ja auch. Habe ich aber nicht getestet.

Hier mal ein mögliche Vorgehen hierzu:

Code:


Private Declare PtrSafe Function OleCreatePictureIndirect Lib "oleaut32.dll" ( _ ByRef PicDesc As PIC_DESC, ByRef RefIID As GUID, _ ByVal fPictureOwnsHandle As LongPtr, ByRef IPic As IPictureDisp) As Long Private Declare PtrSafe Function CopyImage Lib "user32" ( _ ByVal handle As LongPtr, ByVal un1 As Long, ByVal n1 As Long, _ ByVal n2 As Long, ByVal un2 As Long) As LongPtr Private Declare PtrSafe Function IsClipboardFormatAvailable Lib "user32" ( _ ByVal wFormat As Long) As Long Private Declare PtrSafe Function GetClipboardData Lib "user32" ( _ ByVal wFormat As Long) As LongPtr Private Declare PtrSafe Function OpenClipboard Lib "user32" ( _ ByVal hWnd As LongPtr) As Long Private Declare PtrSafe Function CloseClipboard Lib "user32" () As Long Private Type GUID Data1 As Long Data2 As Integer Data3 As Integer Data4(0 To 7) As Byte End Type Private Type PIC_DESC lSize As Long lType As Long hPic As LongPtr hPal As LongPtr End Type Sub Paste_Picture_In_UF(oUF As Object) ' Fügt ein Bild aus der Zwischenablage in ein Userform-ImageControl _ ein Dim oPict As IPictureDisp Dim tPicInfo As PIC_DESC, tID_IDispatch As GUID If IsClipboardFormatAvailable(2) <> 0 Then ' 2 = CF_BITMAP If OpenClipboard(0&) <> 0 Then With tID_IDispatch .Data1 = &H20400 .Data4(0) = &HC0 .Data4(7) = &H46 End With With tPicInfo .lSize = LenB(tPicInfo) .lType = 1 ' 1 = PICTYPE_BITMAP .hPic = CopyImage(GetClipboardData(2), 0, 0, 0, &H4) If .hPic <> 0 Then _ OleCreatePictureIndirect tPicInfo, tID_IDispatch, 0&, oPict End With CloseClipboard If Not oPict Is Nothing Then oUF.Picture = oPict Else MsgBox "Das Bild kann nicht angezeigt werden", vbCritical, "Bild einfügen" End If End If End If End Sub Sub Test() ThisWorkbook.Sheets("Tabelle1").Range("A20:B22").Copy DoEvents ' Achtung, wichtig Call Paste_Picture_In_UF(UserForm1.Image3) ' <<< anpassen >>> UserForm1.Show End Sub

_________________________
viele Grüße aus Freigericht 😊
Karl-Heinz



Anzeige
AW: Pivot in Userform
29.03.2023 13:10:06
Tim
Mit dem Screenshot oder mit dem Bild ist eine gute Idee.. Wo füge ich den Code ein? In der Userform oder ins Modul?


AW: Pivot in Userform
29.03.2023 13:58:53
Volti
Am besten in ein Modul
LG KH


AW: Pivot in Userform
29.03.2023 13:47:57
Yal
Hallo Leo,

Kannst Du uns ausleuchten, was Du damit vorhast?
Du suchst eine Lösung für den Weg zur Lösung eines anderen Problem. Wenn eine andere Weg möglich ist, hast Du ein Problem weniger.

Ein Pivot in einem Userform ist aus gutem Grund von Excel nicht vorgesehen.

VG
Yal

Links zu Excel-Dialogen

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige