Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
624to628
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
624to628
624to628
Aktuelles Verzeichnis
Verzeichnis Index
Verzeichnis Index
Übersicht Verzeichnisse
Inhaltsverzeichnis

Ist ID des Dateimenüs immer gleich ?

Ist ID des Dateimenüs immer gleich ?
16.06.2005 17:00:01
Vliegen
Hallo allen,
Muss auf einer mehrsprachig genutzten Excelanwendung die Menuleiste umgestalten. Soll bei Open und Before Close der Datei umgestellt werden so dass nur diese Datei betroffen ist.
Ich will eigentlich bis auf einige Menüs alles andere aus- beziehungsweise unsichtbar schalten.
Würde daher gerne wissen ob die ID des Dateimenüs immer die gleiche (égal welcher Rechner und égal welche Officesprachversion). Bei mir ist es 3007 und befindet sich auf CommandBars(1). Bleibt das so auf anderen Rechner oder sind die IDs variabel und müssen erst ermittelt werden?
Falls IDs fix sind wo kann ich Listen finden die jeweiligen IDs der Menüs enthalten.
Dann könnte ich nämlich alle anderen Menus die mich nicht interessieren mit einer for each Schleife ausschalten.
Stelle mir noch eine weitere Frage. Wenn ich den ganzen Kram mit einer for each Schleife ausgeschaltet habe wie kriege ich dann den Ursprungszustand beim Verlassen wieder hin. Reicht da eine Anweisung wie Application.CommandBars(1).Reset ? Oder muss ich da mehr Aufwand betreiben.
Freue mich auf eure Ratschläge.
Gruss,
François

5
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Ist ID des Dateimenüs immer gleich ?
16.06.2005 17:28:22
ransi


      
Hallo Fliegen
habe da vor einiger zeit mal was gebastelt.
Der code baut eine neue commandbar 
in der alle anderen commandbars abgebildet sind.
Sämtliche buttons und controls 
in der neueun bar sind ohne funktion.
Dient mir als nachschlagewerk für genau dein problem.
die neue bar löscht sich nicht selber.
schau es dir am besten mal mal an..
Habe das gleiche nochmal im treeview nachgebildet. allerdings ohne die symbole.
wenn du intersesse am treeview hast melde dich noch mal..
Public 
Sub Zeig_Alles()
    
Dim reset As CommandBarControl
    
Dim cb As CommandBar
    
Dim c As CommandBar
    
Dim a As CommandBar 'Zähler
    Dim b As CommandBarControl
    
Dim cneu As CommandBarControl 'neu
    Dim d As CommandBarControl 'Zähler
    Dim e As CommandBarControl 'neu
    Dim f As CommandBarControl 'Zähler
    Dim g As CommandBarControl 'neu
    Dim h As CommandBarControl 'zähler
    Dim i As CommandBarControl 'neu
    Dim j As CommandBarControl
    
Dim k As CommandBarControl
    
Dim vb As CommandBarControl
   
On Error Resume Next
DoEvents
Application.ScreenUpdating = 
False
For Each cb In Application.CommandBars
    
If cb.Name = "Alle Infos" Then cb.Delete
Next
Set c = Application.CommandBars.Add(Name:="Alle Infos")
Set b = c.Controls.Add(10)
Set vb = c.Controls.Add(10)
Set reset = c.Controls.Add(1)
b.Caption = 
"ID's "
vb.Caption = 
"VBE's"
With reset 'für Neuberechnung
    .Caption = "Reset"
    .Style = msoButtonIconAndCaption
    .FaceId = 940
    .OnAction = 
"Zeig_alles"
End With
c.Visible = 
True
'#############################################################
For Each a In Application.CommandBars
    
If a.Name <> "Alle Infos" Then
        
Set cneu = b.Controls.Add(Type:=msoControlPopup)
        cneu.Caption = a.NameLocal & 
" ID:=" & a.ID & ", Type:= " & a.Type
'##############################################################
        If a.Controls.Count > 0 Then
        
For Each d In a.Controls
            
If Not d Is Nothing Then
                
Set e = cneu.Controls.Add(Type:=IIf(d.Type = 1, 1, 10))
                
With e 'Eigenschaften des Originals abschreiben
                    .Caption = d.Caption & " ID:=" & d.ID & ", Type:= " & d.Type
                    .Style = d.Style
                    .FaceId = d.FaceId
                    .BeginGroup = d.BeginGroup
                
End With
            
End If
'##############################################################
            If d.Controls.Count > 0 Then
            
For Each f In d.Controls
                
If Not f Is Nothing Then
                    
Set g = e.Controls.Add(Type:=IIf(f.Type = 1, 1, 10))
                    
With g 'Eigenschaften des Originals abschreiben
                        .Caption = f.Caption & " ID:=" & f.ID & ", Type:= " & f.Type
                        .Style = f.Style
                        .FaceId = f.FaceId
                        .BeginGroup = f.BeginGroup
                    
End With
                
End If
'###############################################################
                If f.Controls.Count > 0 Then
                
For Each h In f.Controls
                    
If Not h Is Nothing Then
                        
Set i = g.Controls.Add(Type:=IIf(h.Type = 1, 1, 10))
                        
With i 'Eigenschaften des Originals abschreiben
                            .Caption = h.Caption & " ID:=" & h.ID & ", Type:= " & h.Type
                            .Style = h.Style
                            .FaceId = h.FaceId
                            .BeginGroup = h.BeginGroup
                        
End With
                    
End If
'#################################################################
                    For Each j In h.Controls
                    
If Not j Is Nothing Then
                    
Set k = i.Controls.Add(Type:=IIf(j.Type = 1, 1, 10))
                    
With k
                    .Caption = j.Caption & 
" ID:=" & j.ID & ", Type:= " & j.Type
                            .Style = j.Style
                            .FaceId = j.FaceId
                            .BeginGroup = j.BeginGroup
                        
End With
                    
End If
                    
Next
'#################################################################
                Next
             
End If
            
Next
        
End If
        
Next
        
End If
    
End If
Next
Set a = Nothing
Set reset = Nothing
Set cb = Nothing
Set c = Nothing
Set d = Nothing
Set cneu = Nothing
Set e = Nothing
Set f = Nothing
Set g = Nothing
Set h = Nothing
Set i = Nothing
Set j = Nothing
Set k = Nothing
For Each a In Application.VBE.CommandBars
    
'If a.Name <> "Alle Infos" Then
        Set cneu = vb.Controls.Add(Type:=msoControlPopup)
        cneu.Caption = a.NameLocal & 
" ID:=" & a.ID & ", Type:= " & a.Type
'##############################################################
        If a.Controls.Count > 0 Then
        
For Each d In a.Controls
            
If Not d Is Nothing Then
                
Set e = cneu.Controls.Add(Type:=IIf(d.Type = 1, 1, 10))
                
With e 'Eigenschaften des Originals abschreiben
                    .Caption = d.Caption & " ID:=" & d.ID & ", Type:= " & d.Type
                    .Style = d.Style
                    .FaceId = d.FaceId
                    .BeginGroup = d.BeginGroup
                
End With
            
End If
'##############################################################
            If d.Controls.Count > 0 Then
            
For Each f In d.Controls
                
If Not f Is Nothing Then
                    
Set g = e.Controls.Add(Type:=IIf(f.Type = 1, 1, 10))
                    
With g 'Eigenschaften des Originals abschreiben
                        .Caption = f.Caption & " ID:=" & f.ID & ", Type:= " & f.Type
                        .Style = f.Style
                        .FaceId = f.FaceId
                        .BeginGroup = f.BeginGroup
                    
End With
                
End If
'###############################################################
                If f.Controls.Count > 0 Then
                
For Each h In f.Controls
                    
If Not h Is Nothing Then
                        
Set i = g.Controls.Add(Type:=IIf(h.Type = 1, 1, 10))
                        
With i 'Eigenschaften des Originals abschreiben
                            .Caption = h.Caption & " ID:=" & h.ID & ", Type:= " & h.Type
                            .Style = h.Style
                            .FaceId = h.FaceId
                            .BeginGroup = h.BeginGroup
                        
End With
                    
End If
'#################################################################
                    For Each j In h.Controls
                    
If Not j Is Nothing Then
                    
Set k = i.Controls.Add(Type:=IIf(j.Type = 1, 1, 10))
                    
With k
                    .Caption = j.Caption & 
" ID:=" & j.ID & ", Type:= " & j.Type
                            .Style = j.Style
                            .FaceId = j.FaceId
                            .BeginGroup = j.BeginGroup
                        
End With
                    
End If
                    
Next
'#################################################################
                Next
             
End If
            
Next
        
End If
        
Next
        
End If
   
' End If
Next
Application.ScreenUpdating = 
True
Set a = Nothing
Set reset = Nothing
Set cb = Nothing
Set c = Nothing
Set d = Nothing
Set cneu = Nothing
Set e = Nothing
Set f = Nothing
Set g = Nothing
Set h = Nothing
Set i = Nothing
Set j = Nothing
Set k = Nothing
Set vb = Nothing
End Sub
ransi 
Anzeige
AW: Ist ID des Dateimenüs immer gleich ?
16.06.2005 17:40:04
Vliegen
Hallo Ransi,
Meine sponatane, erste Reaktion war Uuups ! Aber auf jeden Fall vielen Dank !
Hab nicht gedacht dass einer soviel Code schicken würde. Muss mich da heute abend mal durchbeissen.
Bin mir aber nicht sicher ob ich sowas komplexes brauche denn mein Gedanke war es einfach alles ausschalten was unnötig ist und nur wenige Menus lassen.
Mache jedenfalls jetzt mal Feierabend und klemme mich daheim nochmals vor den PC.
Gruss aus Belgien,
François
wenn du dich da durchbeisst...
16.06.2005 17:53:30
ransi
hallo vliegen
...sicher aber vorher dein excel*.xlb.
habe mir einmal meine umgebung zerschossen als ich mit commandbars experimentiert habe.
war eine mordsarbeit die alten einstellungen wieder zu bekommen und mir eine lehre fürs leben....
ransi
Anzeige
AW: Ist ID des Dateimenüs immer gleich ?
16.06.2005 17:31:33
ransi
hallo
habe ich vergessen zu erwähnen...
habe bei mir office XP.
da läuft es.
ransi
AW: Ist ID des Dateimenüs immer gleich ?
16.06.2005 17:42:45
Vliegen
Danke,
Hab privat auch Xp und hier im Büro Excel 2003. Es heisst ja Microsoft macht Sachen die abwärtskompatibel sind. Also müsste es ja klappen.
Gruss,
Francois
N.B. Vliegen Fliegen

Links zu Excel-Dialogen

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige