Microsoft Excel

Excel und VBA: Formeln, Programmierung, Lösungen

Die Excel/VBA-Beispiele

Thema

Auslesen der aktuell in der Zwischenablage vorhandenen Formate

Gruppe

ClipBoard

Problem

Die aktuell in der Zwischenablage vorhandenen Formate sollen ausgelesen werden.

Lösung
Geben Sie den nachfolgenden Code in ein Standardmodul ein und weisen Sie ihn einer Schaltfläche zu.

StandardModule: Modul1

Sub TestClipboard()
   Dim vaFormats As Variant, dFormat As Variant
   vaFormats = Application.ClipboardFormats
   For Each dFormat In vaFormats
      Select Case dFormat
         Case xlClipboardFormatBIFF
            MsgBox "xlClipboardFormatBIFF (" & dFormat & ")"
         Case xlClipboardFormatBIFF2
            MsgBox "xlClipboardFormatBIFF2 (" & dFormat & ")"
         Case xlClipboardFormatBIFF3
            MsgBox "xlClipboardFormatBIFF3 (" & dFormat & ")"
         Case xlClipboardFormatBIFF4
            MsgBox "xlClipboardFormatBIFF4 (" & dFormat & ")"
         Case xlClipboardFormatBinary
            MsgBox "xlClipboardFormatBinary (" & dFormat & ")"
         Case xlClipboardFormatBitmap
            MsgBox "xlClipboardFormatBitmap (" & dFormat & ")"
         Case xlClipboardFormatCGM
            MsgBox "xlClipboardFormatCGM (" & dFormat & ")"
         Case xlClipboardFormatCSV
            MsgBox "xlClipboardFormatCSV (" & dFormat & ")"
         Case xlClipboardFormatDIF
            MsgBox "xlClipboardFormatDIF (" & dFormat & ")"
         Case xlClipboardFormatDspText
            MsgBox "xlClipboardFormatDspText (" & dFormat & ")"
         Case xlClipboardFormatEmbeddedObject
            MsgBox "xlClipboardFormatEmbeddedObject (" & dFormat & ")"
         Case xlClipboardFormatEmbedSource
            MsgBox "xlClipboardFormatEmbedSource (" & dFormat & ")"
         Case xlClipboardFormatLink
            MsgBox "xlClipboardFormatLink (" & dFormat & ")"
         Case xlClipboardFormatLinkSource
            MsgBox "xlClipboardFormatLinkSource (" & dFormat & ")"
         Case xlClipboardFormatLinkSourceDesc
            MsgBox "xlClipboardFormatLinkSourceDesc (" & dFormat & ")"
         Case xlClipboardFormatMovie
            MsgBox "xlClipboardFormatMovie (" & dFormat & ")"
         Case xlClipboardFormatNative
            MsgBox "xlClipboardFormatNative (" & dFormat & ")"
         Case xlClipboardFormatObjectDesc
            MsgBox "xlClipboardFormatObjectDesc (" & dFormat & ")"
         Case xlClipboardFormatObjectLink
            MsgBox "xlClipboardFormatObjectLink (" & dFormat & ")"
         Case xlClipboardFormatOwnerLink
            MsgBox "xlClipboardFormatOwnerLink (" & dFormat & ")"
         Case xlClipboardFormatPICT
            MsgBox "xlClipboardFormatPICT (" & dFormat & ")"
         Case xlClipboardFormatPrintPICT
            MsgBox "xlClipboardFormatPrintPICT (" & dFormat & ")"
         Case xlClipboardFormatRTF
            MsgBox "xlClipboardFormatRTF (" & dFormat & ")"
         Case xlClipboardFormatScreenPICT
            MsgBox "xlClipboardFormatScreenPICT (" & dFormat & ")"
         Case xlClipboardFormatStandardFont
            MsgBox "xlClipboardFormatStandardFont (" & dFormat & ")"
         Case xlClipboardFormatStandardScale
            MsgBox "xlClipboardFormatStandardScale (" & dFormat & ")"
         Case xlClipboardFormatSYLK
            MsgBox "xlClipboardFormatSYLK (" & dFormat & ")"
         Case xlClipboardFormatTable
            MsgBox "xlClipboardFormatTable (" & dFormat & ")"
         Case xlClipboardFormatText
            MsgBox "xlClipboardFormatText (" & dFormat & ")"
         Case xlClipboardFormatToolFace
            MsgBox "xlClipboardFormatToolFace (" & dFormat & ")"
         Case xlClipboardFormatToolFacePICT
            MsgBox "xlClipboardFormatToolFacePICT (" & dFormat & ")"
         Case xlClipboardFormatVALU
            MsgBox "xlClipboardFormatVALU (" & dFormat & ")"
         Case xlClipboardFormatWK1
            MsgBox "xlClipboardFormatWK1 (" & dFormat & ")"
         Case Else
            MsgBox "Zwischenablage ist leer (" & dFormat & ")"
      End Select
   Next
End Sub