![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Hey,
I have an exchange mailbox here and I want to poulate the subject field with some text every time someone clicks 'New Mail' Is this possible? If so, how do I do it? Google results are not very informative Cheers Tal |
Ads |
#2
|
|||
|
|||
![]()
Once way to do it would be to create a Macro that does this And set it up as a quick action button to create the e-mail instead of using the "New E-Mail" button.
The problem with the using the New E-Mail button is that this is programmed into Outlook and really no way to change the "funtion" of this. However, but creating a macro and assigning it a button, you can accomplish what you are asking. Macro: Public Sub CreateEmail() 'Create the oMail object Dim oMail As Outlook.MailItem 'Create a new mail item Set oMail = Application.CreateItem(olMailItem) 'Set the subject With oMail .Subject = "This is the subject" .Display End With End Sub Once you put this into a module and save it, do the following: - File - Options - Click Quick Access Toolbar - In the dropdown box for "Choose commands from:", select "Macros" - Click on the name of the Macro (Should be something like Project1.CreateEmail) and click "Add" - Select the name from the "Customize Quick Access Toolbar" box and select modify - You can rename itand even set an icon - Click "Ok" until all the windows disappear - The new Icon should appear in the top left corner. When you click on it, it should do what you want. Some other notes: You can also set the To, CC, BCC, Body, Send From, Reply To, and attachments as well by using .To, .CC, .BCC, .Body, .SentOnBehalfOfName, .ReplyRecipients.Add, and .Attachments.Add respectively. Hope this helps! |
#3
|
|||
|
|||
![]()
There is a way to do this. There is a great article http://blogs.officezealot.com/legault/pages/20086.aspx that explains in detail, but here is the general idea:
- Open VBA (Alt-F11) and open "ThisOutlookSession" - Put in the following code: Code:
Option Explicit Dim myMailItemTrapper As clsMailItemTrapper Private Sub Application_Startup() Set myMailItemTrapper = New clsMailItemTrapper End Sub Private Sub Application_Quit() Set myMailItemTrapper = Nothing End Sub - In the new class, put in the following: Code:
Option Explicit Dim WithEvents objInspectors As Outlook.Inspectors Dim WithEvents objOpenInspector As Outlook.Inspector Dim WithEvents objMailItem As Outlook.MailItem Private Sub Class_Initialize() Set objInspectors = Application.Inspectors End Sub Private Sub Class_Terminate() Set objOpenInspector = Nothing Set objInspectors = Nothing Set objMailItem = Nothing End Sub Private Sub objInspectors_NewInspector(ByVal Inspector As Inspector) If Inspector.CurrentItem.Class = olMail Then Set objMailItem = Inspector.CurrentItem Set objOpenInspector = Inspector End If End Sub Private Sub objMailItem_Open(Cancel As Boolean) objMailItem.Subject = "Put your subject here" End Sub As I said, check out that site for more details as you can just about do anything you need to. Last edited by NDuarte : May 31st 12 at 10:34 PM. Reason: Added Code Tags |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro: Create New Message and Auto populate To Field | geosptial | Outlook and VBA | 5 | August 14th 09 03:04 PM |
Populate task field based on value of other field | jparker | Outlook and VBA | 9 | March 12th 09 04:50 PM |
Help needed to auto populate Subject field -Outlook 2003 custom ms | Mr Reorg | Outlook - Using Forms | 6 | August 2nd 08 05:41 PM |
Populate Message field based on custom field | Kryer | Outlook - Using Forms | 8 | September 7th 07 11:19 PM |
Populate Company field from Contact field in custom task form | Sue Mosher [MVP-Outlook] | Outlook - Using Forms | 0 | January 20th 06 08:37 PM |