Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / December 2003

Tip: Looking for answers? Try searching our database.

Autoopen macro in outlook

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Raymond - 30 Dec 2003 08:24 GMT
Hi

On the internet i've found this code with you heve to put in
thisoutlooksession so that users can't edit the outlookbar

VB:
--------------------------------------------------------------------------------
Dim WithEvents oPane As OutlookBarPane
Dim WithEvents oGroups As OutlookBarGroups
Dim WithEvents oShortcuts As OutlookBarShortcuts

Private Sub Application_Startup()
Set oPane = ActiveExplorer.Panes(1)
Set oGroups = oPane.Contents.Groups
Set oShortcuts = oPane.CurrentGroup.Shortcuts
End Sub

Private Sub oGroups_BeforeGroupAdd(Cancel As Boolean)
MsgBox "Sorry, you cannot add a group to the Outlook Bar."
Cancel = True
End Sub

Private Sub oGroups_BeforeGroupRemove _
(ByVal Group As OutlookBarGroup, Cancel As Boolean)
MsgBox "Sorry, you cannot remove a group from the Outlook Bar."
Cancel = True
End Sub

Private Sub oPanes_BeforeGroupSwitch _
(ByVal ToGroup As OutlookBarGroup, Cancel As Boolean)
Set oShortcuts = ToGroup.Shortcuts
End Sub

Private Sub oShortcuts_BeforeShortcutAdd(Cancel As Boolean)
MsgBox "Sorry, you cannot add a shortcut to the Outlook Bar."
Cancel = True
End Sub

Private Sub oShortcuts_BeforeShortcutRemove _
(ByVal Shortcut As OutlookBarShortcut, Cancel As Boolean)
MsgBox "Sorry, you cannot delete a shortcut from the Outlook
Bar."
Cancel = True
End Sub
--------------------------------------------------------------------------------

Because I want to show a VBA userform in outlook when a user opens a
mail item

I've add the fulling code

VB:
--------------------------------------------------------------------------------
Private Sub Application_Startup()
Set oPane = ActiveExplorer.Panes(1)
Set oGroups = oPane.Contents.Groups
Set oShortcuts = oPane.CurrentGroup.Shortcuts
Mailitem_Open
End Sub

Sub Mailitem_Open()
Dim test
If Mailitem.UnRead = False Then
myMsg = "Do you want to open this message again?"
If MsgBox(myMsg, 4) = 6 Then
test = True
MsgBox test
Else
test = False
MsgBox test
End If
End If
End Sub
--------------------------------------------------------------------------------

When I run this Code i get error 424. Can anyone tell why?

It's almost a function I've found in the help from visual basic. But
say that it's for VBScript.

Greetings Raymond

------------------------------------------------
adamz5 - 31 Dec 2003 14:03 GMT
Where are you writing this code:
Is it in the scripting agent or in vba editor in outlook..?
Cheers

Adam

> Hi
>
[quoted text clipped - 79 lines]
>
> ------------------------------------------------
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.