ich möchte gern prüfen, wenn ein Button in einer Tabelle schon vorhanden ist,
msgbox "Button schon da " erscheinen.
mfg Walter mb
Sub Button()
On Error Resume Next
Sheets("Cache").OLEObjects ("CommandButton1") ' Sheetname anpassen
If Err.Number 0 Then
MsgBox "CommandButton1 nicht da !", vbCritical
Else
MsgBox "CommandButton1 da !", vbInformation
End If
On Error GoTo 0
End Sub
In diesem Fall für den ComandButton1.
Gruß
Chris
Sub Button()
On Error Resume Next
Sheets("Test").OLEObjects ("Button") ' Sheetname anpassen
If Err.Number 0 Then
MsgBox "CommandButton1 nicht da !", vbCritical
Else
MsgBox "CommandButton1 da !", vbInformation
End If
On Error GoTo 0
End Sub
mfg walter mb
Sub auslesen_alle_elemente()
Dim shShape As Shape
For Each shShape In Worksheets("Tabelle1").Shapes
If shShape.Name = "Button" Then
MsgBox "Button ist da"
Exit For
End If
Next shShape
End Sub
Sub Button_auslesen_alle_elemente()
Dim shShape As Shape
For Each shShape In Worksheets("Test").Shapes
If shShape.Name = "Button" Then
MsgBox "Button ist da"
Exit For
End If
Next shShape
MsgBox "Button fehlt"
End Sub
Der Tabellenname ist "Test" hab auch mal "Schaltfläche" eingesetzt, bei mir kommt
immer : MsgBox "Button fehlt"
Es ist aus der Formular-Symbolleiste .
Wo kann den da ein Fehler sein.
mfg walter mb
Sub Button_auslesen_alle_elemente()
Dim shShape As Shape
For Each shShape In Worksheets("Test").Shapes
msgbox shShape.Name
Next shShape
End Sub
Gruß
Reinhard
Sub Button_auslesen_alle_elemente()
Dim shShape As Shape
For Each shShape In Worksheets("Test").Shapes
MsgBox shShape.Name
Next shShape
End Sub
jetzt brauch ich nur die Info:
MsgBox "Button ist da"
MsgBox "Button fehlt"
mfg walter mb
Sub Button2_auslesen_alle_elemente()
Dim shShape As Shape
For Each shShape In Worksheets("Test").Shapes
If shShape.Name = "Button" 1 Then
MsgBox "Button ist da"
Exit Sub
Exit For
End If
Next shShape
MsgBox "Button fehlt"
'hier mein Makro rein ...
End Sub
mfg walter mb