Dieses Forum nutzt Cookies
Dieses Forum verwendet Cookies, um deine Login-Informationen zu speichern, wenn du registriert bist, und deinen letzten Besuch, wenn du es nicht bist. Cookies sind kleine Textdokumente, die auf deinem Computer gespeichert werden. Die von diesem Forum gesetzten Cookies werden nur auf dieser Website verwendet und stellen kein Sicherheitsrisiko dar. Cookies aus diesem Forum speichern auch die spezifischen Themen, die du gelesen hast und wann du zum letzten Mal gelesen hast. Bitte bestätige, ob du diese Cookies akzeptierst oder ablehnst.

Ein Cookie wird in deinem Browser unabhängig von der Wahl gespeichert, um zu verhindern, dass dir diese Frage erneut gestellt wird. Du kannst deine Cookie-Einstellungen jederzeit über den Link in der Fußzeile ändern.

'interne' Schaltflächennummer ermitteln
#1
Hallo,

in einem Tabellenblatt befinden sich mehrere Schaltflächen (Commandbuttons via Formularsteuerelemente), deren Beschriftung (Caption) geändert wurde.

Frage: Wie kann man die 'interne' Schaltflächennummer ermitteln? Auch bei markierter Schaltfläche werden nur die Tabellenblatteigenschaften angezeigt.

VG!
Antworten Top
#2
Hallo, :19:

probiere es mal so: :21:

.xlsb   Schaltflaeche_Application_Caller_Caption_und_Nummer.xlsb (Größe: 15,92 KB / Downloads: 7)
________
Servus
Case
Antworten Top
#3
Hallo Wanderfalke,

einmal folgendes testen.

Im 1. Makro mit .Name
Im 2. Makro mit .ID, hier werden die Nummern ausgegeben
Code:
'Mit .Name
Sub Shape_TopLeftCell_Name()
    Dim sh As Shape

    For Each sh In ActiveSheet.Shapes
        With sh
            Select Case .TopLeftCell.Address

                'Shapes im Bereich
                Case "$C$1", "$E$1", "$G$1", "$I$1"
                    If .Type = 12 Then MsgBox "Shapes TopLeftCell: " & .TopLeftCell.Address _
                        & vbLf & vbLf & "Shapes ist ein Formularsteuerelement:" & vbLf & .Name
                   
                    If .Type = 8 Then MsgBox "Shapes TopLeftCell: " & .TopLeftCell.Address _
                        & vbLf & vbLf & "Shapes ist ein ActiveX-Steuerelement:" & vbLf & .Name

                'Shapes außerhalb des Oben genannten Bereichs
                Case Else
                    If .Type = 8 Then MsgBox "Shapes ist außerhalb des Bereichs:" _
                        & vbLf & "Shapes TopLeftCell: " & .TopLeftCell.Address _
                        & vbLf & vbLf & "Shapes ist ein ActiveX-Steuerelement:" _
                        & vbLf & .Name

                    If .Type = 12 Then MsgBox "Shapes ist außerhalb des Bereichs:" _
                        & vbLf & "Shapes TopLeftCell: " & .TopLeftCell.Address _
                        & vbLf & vbLf & "Shapes ist ein Formularsteuerelement:" _
                        & vbLf & .Name

                    If .Type = 13 Then MsgBox "Shapes ist außerhalb des Bereichs:" _
                        & vbLf & "Shapes TopLeftCell: " & .TopLeftCell.Address _
                        & vbLf & vbLf & "Shapes ist eine Grafik:" _
                        & vbLf & .Name

            End Select

        End With

    Next sh

End Sub
Code:
'Mit .ID, statt .Name
Sub Shape_TopLeftCell_ID()
    Dim sh As Shape

    For Each sh In ActiveSheet.Shapes
        With sh
            Select Case .TopLeftCell.Address

                'Shapes im Bereich
                Case "$C$1", "$E$1", "$G$1", "$I$1"
                    If .Type = 12 Then MsgBox "Shapes TopLeftCell: " & .TopLeftCell.Address _
                        & vbLf & vbLf & "Shapes ist ein Formularsteuerelement:" & vbLf & .ID
                   
                    If .Type = 8 Then MsgBox "Shapes TopLeftCell: " & .TopLeftCell.Address _
                        & vbLf & vbLf & "Shapes ist ein ActiveX-Steuerelement:" & vbLf & .ID

                'Shapes außerhalb des Oben genannten Bereichs
                Case Else
                    If .Type = 8 Then MsgBox "Shapes ist außerhalb des Bereichs:" _
                        & vbLf & "Shapes TopLeftCell: " & .TopLeftCell.Address _
                        & vbLf & vbLf & "Shapes ist ein ActiveX-Steuerelement:" _
                        & vbLf & .ID

                    If .Type = 12 Then MsgBox "Shapes ist außerhalb des Bereichs:" _
                        & vbLf & "Shapes TopLeftCell: " & .TopLeftCell.Address _
                        & vbLf & vbLf & "Shapes ist ein Formularsteuerelement:" _
                        & vbLf & .ID

                    If .Type = 13 Then MsgBox "Shapes ist außerhalb des Bereichs:" _
                        & vbLf & "Shapes TopLeftCell: " & .TopLeftCell.Address _
                        & vbLf & vbLf & "Shapes ist eine Grafik:" _
                        & vbLf & .ID

            End Select

        End With

    Next sh

End Sub
Gruß Karl
Antworten Top
#4
Hallo Case, hallo Karl,

vielen Dank für eure Infos. Beides funktioniert wie es soll.

VG!
Antworten Top


Gehe zu:


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste