|Determine the "identity" of your emails. Set with SAM the sender and the folder folder for sent items with the help of rules.|
Some properties of the Outlook object model are blocked due to security reasons. For instance, if try to send an email from Excel via Outlook, the user gets a prompt and must explicitly allow the sending. Since Outlook 2003 you can workaround the issue: All you need to do is derive all objects from the instrinsic Application object.
Many VBA samples try to create a new instance of the own host application. That is unneccessary for all VBA projects, in Outlook 2003 it could even lead to a disabled VBA, and in any case it leads to that Outlook doesn' trust your code.
So the question is, how can you use the intrinsic Outlook Application object from within, say, Excel so that it trusts your code? The solution is simple: Make the property public. As this isn't officially supported, Microsoft could stop this method from working anytime.
Add the following code to the ThisOutlookSession module. It's important to declare it as public and the returned type as object.
Important: I strongly recommend that you use your own name for the public property, a name that nobody else knows.
Public Property Get MySecretPropertyName() As Object Set MySecretPropertyName = Application End Property
The following code demonstrates the issue: With the usualy call from Excel to Outlook the security prompt will be raised when you try to read, for instance, the address of an email. (It's assumed that Outlook is already running.)
Private Sub Test() Dim Outlook As Outlook.Application Dim Mail as Outlook.MailItem Dim Folder As Outlook.MAPIFolder Set Outlook = GetObject(, "Outlook.Application") Set Folder = Outlook.Session.GetDefaultFolder(olFolderInbox) Set Mail = Folder.Items(1) Debug.Print Mail.Recipients(1).Address End Sub
|With Category-Manager you can group your Outlook categories, share them with other users, filter a folder by category, automatically categorize new emails, and more. You can use the Addin even for IMAP.|
Instead of deriving the email from the Application object that is returned by the GetObject function, we derive it from the property that we added to ThisOutlookSession. This way you won't see the security prompt.
Private Sub Test() Dim LockedOutlook As Outlook.Application Dim Outlook As Object Dim Mail as Outlook.MailItem Dim Folder As Outlook.MAPIFolder Set LockedOutlook = GetObject(, "Outlook.Application") Set Outlook = LockedOutlook.MySecretPropertyName Set Folder = Outlook.Session.GetDefaultFolder(olFolderInbox) Set Mail = Folder.Items(1) Debug.Print Mail.Recipients(1).Address End Sub
|OLKeeper reliably prevents users from closing their Outlook window and thus possibly missing reminders or e-mails.|