Aktuell kann es Probleme bei der Anmeldung mit dem Chrome oder Edge Browser geben. Ihr müsstet in die Einstellungen des Browsers gehen und Cache, Cookies und sofern vorhanden, gespeicherte Passwörter vom CEF löschen oder alternativ auf einen anderen Browser ausweichen. Ursache sind vermutlich kürzliche Browserupdates. x

'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!
Top
#2
Hallo, :19:

probiere es mal so: :21:
[attachment=30879]
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
Top
#4
Hallo Case, hallo Karl,

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

VG!
Top


Gehe zu:


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