T
technomane
Hello all,
hope you can help me with my problem here. The following code crashe
at line "Set myInspector = myItemb.GetInspector" (Outlook completel
crashes and needs to restart). I have no idea why this happens. Fro
what I've tried, it only crashes when the macro is started right afte
OL startup, while no inspector item was yet launched. When I click o
e.g. "New E-Mail" first (open/close the inspector), it will not crash.
Purpose of the whole thing is to add a user-defined command bar t
every new inspector item (like you would do via "customize" -> "comman
bars" -> "macros" menu)
Any help is highly appreciated
Sub DisplayFollowUpBarMenus()
Dim myOlApp As Outlook.Application
Dim myItemb As Outlook.MailItem
Dim myInspector As Outlook.Inspector
Dim cmb As CommandBar
Dim insp As Inspector
Set myOlApp = Nothing
Set myItemb = Nothing
Set myInspector = Nothing
Set myOlApp = CreateObject("Outlook.Application")
Set myItemb = myOlApp.CreateItem(olMailItem)
Set myInspector = myItemb.GetInspector
For Each cmb In myInspector.CommandBars
If cmb.Name = "Followup" Then cmb.Delete
Next
Set cb = myInspector.CommandBars.Add(Name:=Followup, _
temporary:=False, Position:=msoBarTop)
cb.Visible = True
Set cbc = cb.Controls.Add(Type:=msoControlButton)
With cbc
.FaceId = 273
.Caption = "morgen"
.Style = msoButtonIconAndCaption
.OnAction = "FUtomorrow"
End With
Set cbc = cb.Controls.Add(Type:=msoControlButton)
With cbc
.FaceId = 273
.Caption = "5"
.OnAction = "FUfivedays"
.Style = msoButtonIconAndCaption
.BeginGroup = True
End With
myInspector.Display
myInspector.Close (olDiscard)
End Su
hope you can help me with my problem here. The following code crashe
at line "Set myInspector = myItemb.GetInspector" (Outlook completel
crashes and needs to restart). I have no idea why this happens. Fro
what I've tried, it only crashes when the macro is started right afte
OL startup, while no inspector item was yet launched. When I click o
e.g. "New E-Mail" first (open/close the inspector), it will not crash.
Purpose of the whole thing is to add a user-defined command bar t
every new inspector item (like you would do via "customize" -> "comman
bars" -> "macros" menu)
Any help is highly appreciated
Sub DisplayFollowUpBarMenus()
Dim myOlApp As Outlook.Application
Dim myItemb As Outlook.MailItem
Dim myInspector As Outlook.Inspector
Dim cmb As CommandBar
Dim insp As Inspector
Set myOlApp = Nothing
Set myItemb = Nothing
Set myInspector = Nothing
Set myOlApp = CreateObject("Outlook.Application")
Set myItemb = myOlApp.CreateItem(olMailItem)
Set myInspector = myItemb.GetInspector
For Each cmb In myInspector.CommandBars
If cmb.Name = "Followup" Then cmb.Delete
Next
Set cb = myInspector.CommandBars.Add(Name:=Followup, _
temporary:=False, Position:=msoBarTop)
cb.Visible = True
Set cbc = cb.Controls.Add(Type:=msoControlButton)
With cbc
.FaceId = 273
.Caption = "morgen"
.Style = msoButtonIconAndCaption
.OnAction = "FUtomorrow"
End With
Set cbc = cb.Controls.Add(Type:=msoControlButton)
With cbc
.FaceId = 273
.Caption = "5"
.OnAction = "FUfivedays"
.Style = msoButtonIconAndCaption
.BeginGroup = True
End With
myInspector.Display
myInspector.Close (olDiscard)
End Su