Makro Workbook_Open läuft nicht
22.02.2008 12:37:47
Werner
wahrscheinlich mache ich einen saublöden Fehler, aber mein Code, der bei Workbook_Open das Kontextmenü erweitern soll, läuft nicht automatisch. Wenn ich ihn händisch anstoße, klappt aber alles. Warum das so ist, kapiere ich nicht - für Hilfe wäre ich sehr dankbar!!
Private Sub Workbook_Open()
Dim sPfad As String
Dim sdate As String
sdate = Format(Date, "dd/mm/yyyy")
sPfad = "Y:\Das\Die\Der\" & sdate & ".xls"
If Dir(sPfad) "" Then GoTo Weiter
ActiveWorkbook.SaveCopyAs Filename:=sPfad
Weiter:
Application.CommandBars("Cell").Enabled = True
Application.CommandBars("Cell").Reset
Dim Kontext As Object
Set Kontext = Application.CommandBars("Cell").Controls.Add(Before:=1)
Kontext.BeginGroup = True
With Kontext
.Caption = "DPL Web"
.OnAction = "DPLWeb2"
.FaceId = 351
End With
Dim Kontext2 As Object
Set Kontext2 = Application.CommandBars("Cell").Controls.Add(Before:=2)
Kontext2.BeginGroup = True
With Kontext2
.Caption = "TP Web"
.OnAction = "TPAktExcel"
.FaceId = 352
End With
Dim Kontext3 As Object
Set Kontext3 = Application.CommandBars("Cell").Controls.Add(Before:=3)
Kontext3.BeginGroup = True
With Kontext3
.Caption = "DPL"
.OnAction = "GeheZuDPL"
.FaceId = 481
End With
End Sub
Danke im Voraus
Werner