Anzeige
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Anzeige
Inhaltsverzeichnis

combobox prob

Forumthread: combobox prob

combobox prob
06.12.2002 19:03:24
leo
hallo zusammen

also ich hab eine eigene menüleiste namens MyCommandbar erstellt. dort gibt es eine combobox namens Dienstpläne wo man alle sichbaren tabellenblätter auswählen kann. jetzt das problem: wenn ich in der combobox das active sheet auswähle kommt ein fehler, wieso??

If Sheets(Application.CommandBars("MyCommandBar") _
.Controls("Dienstpläne").text) = ActiveSheet.Name Then
...

Anzeige

3
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
Re: combobox prob
06.12.2002 19:05:49
MRR
Welcher Code wird ausgeführt, wenn Du ein anderes Blatt wählst?
Matthias
Re: combobox prob
06.12.2002 19:07:29
leo
Public Sub ComboMenueBox()

Dim oBar As CommandBar
Dim oCbo As CommandBarComboBox

Set oBar = Application.CommandBars("MyCommandBar")
On Error Resume Next
oBar.Controls("Dienstpläne").Delete
On Error GoTo 0
With oCbo

Dim i As Integer
Dim wks As Worksheet
Call ComboMenueBox_loeschen
Set oCbo = Application.CommandBars("MyCommandBar") _
.Controls.Add(msoControlComboBox)
With oCbo
.Caption = "Dienstpläne"
.Width = 100
For Each wks In Worksheets
If wks.Name <> "Dienstplan" Then oCbo.AddItem wks.Name
.OnAction = "BlattAuswahl"
Next wks
.text = "Wählen..."
End With

End With

End Sub
_____

Public Sub BlattAuswahl()

On Error GoTo fehler

Sheets(Application.CommandBars("MyCommandBar") _
.Controls("Dienstpläne").text).Select

fehler:
If Sheets(Application.CommandBars("MyCommandBar") _
.Controls("Dienstpläne").text) = ActiveSheet.Name Then
Exit Sub
End If
MsgBox ("Dienstplan nicht auffindbar !")
Call MenuErstellen

End Sub

Anzeige
Re: combobox prob
06.12.2002 23:14:43
M. Kuhn
Moin Leo,

probier mal:

statt: If Sheets(Application.CommandBars("MyCommandBar").Controls("Dienstpläne").text) = ActiveSheet.Name Then

das hier: If Selection.Name = ActiveSheet.Name Then

MfG Mario

Anzeige
Anzeige
Live-Forum - Die aktuellen Beiträge
Datum
Titel
14.05.2026 13:31:09
14.05.2026 09:50:42
13.05.2026 19:14:18