Outlook 2007 Macro to Email Field

Status
Not open for further replies.

LMS

Senior Member
Outlook version
Email Account
Exchange Server
I have outlook 2007 macros that each opens up a e-mail template as a new e-mail. In my contact template, I have added the macros to the tool bar, so can click on the anyone of them, and it opens up a new e-mail based on the e-mail template provided in the macro. How can I add a line to the macro so when I click on it in a contact I opened, it automatically adds the email address of the contact to the e-mail that is opened up per the template. In the contact form, there is the email field, so how do we have the macro add the email of the that field to the "To" bar of the email that is opened up by clicking on the macro?

Thanks very much, as this is the last thing I think I need to learn.
 
Thanks very much, but not clear to me what to do.

The macro I have that goes to the email template and is part of the contact template is as follows:

Sub test()

Set Msg = Application.CreateItemFromTemplate("C:\Users\Stoler Law\AppData\Roaming\Microsoft\Templates\nameoffile.oft")

Msg.Display

End Sub

What can I add to it so it adds the email address of the contact email field automatically to the email that is created from running the macro?

Thanks for you help very much!
 
Replace your macro with either of the macros on the pages I posted and replace the path with your template -

Where my macros say

Set objMsg = Application.CreateItemFromTemplate("C:\path\to\template.oft")

You'll use

Set objMsg = Application.CreateItemFromTemplate("C:\Users\Stoler Law\AppData\Roaming\Microsoft\Templates\nameoffile.oft")

Oh, and my macros work on selected messages, not opened. You can either use the Function at Outlook VBA: work with open item or selected item - Slipstick Systems so it works with either selected or open or change the code so it works only with opened items.

In the second macro example, use this line to work with the function & on opened or selected contacts (add the function to the VB editor following the outlook macro):

If TypeName(ActiveExplorer.Selection.Item(1)) = "ContactItem" Then
Set oContact = GetCurrentItem()

or to only work with the opened contact, use

If TypeName(ActiveInspector.CurrentItem) = "ContactItem" Then
Set oContact = ActiveInspector.CurrentItem
 
Thank you very much.

I am not a technical expert to understand it thru the thread. Is there a way for me to call you and talk for 5 minutes.

I appreciate it very much as I have worked so hard to find the way to do this, and have noticed you are the top expert for this!!
 
I won't have time for a call before Friday. Try the attached macro - it put it in notepad so it won't get messed up in the post.
 

Attachments

  • macros.txt
    968 bytes · Views: 523
I thank you so much. It works perfect and the only thing I needed to do was change a few names in cetain areas so that all the macros work and they don't hit each other, which I will explain to you over the phone on Friday.

The next step is as follows:

I created a new menu in the opening of Outlook where I was able to drag the menu to each macro, and if I highlighted a contact without opening it, the macros work from the new menu.

In the contacts form, I only have been able to add each macro to the Quick Access Toolbar so each one is a separate click and they work perfect.

But is there a way on the Contact template (which I created) for to create a new menu or drop list so I can click on it and scroll down to the macros, as that would be more convenient as each one will show up with a title in the menu or droplist and not be across the whole area of the toolbar.

Again, thank you very very much as this now works perfectly!!
 
In Outlook 2007, you are limited with what you can do s far as menus. It's either the simple method to add to the QAT or create your own ribbon tab. I don't have instructions handy for a custom ribbon handy and I haven't done it in years.
 
Thanks so much for letting me now so quickly.

And again, the macro I used from you is perfect!!
 
Once again, the question is, is there a way to create a new menu bar in the contact template or a drop down list, so I don't have to have a long horizontel list of bullets to run the macros when I open a contact, , but have the new menu/drop down list just like it works in the new menu bar as part of Outlook when you open Outlook?

I just found out that in the form of a contact template, under the commands you can add to the Quick Access Tool Bar, there is a a "Custom Toolbars" command, and a "Menu Commands" command, and when you add those and run the contact form, they show up each with a drop down list, but nothing is in the list, and so is there a way to add the macros to either of those commands? That might be a way to take care of my question.

Thanks very much, as I now have about 20 macros and would prefer to show a list of different macros versus a button for each one one a contact template.
 
And in addition to the foregoing, there is way that you can add to the toolbar on the contact template a command called: "View Macros" which shows the full list of macros with their formal word names (no space) and you can run the macro from that list.

So if there is a way to customize how you view the macros, that might be helpful as well.

Thanks very much.
 
In Outlook 2007, your options are limited to using the quick access toolbar or writing a custom ribbon.

Customizing the Ribbon in Outlook 2007

The Developer ribbon has a Macros button on it - you could/should be able to add that to the QAT or just keep the developer ribbon enabled.

view-nmacros.png

(The command for the view macros dialog is listed under All Commands and is called View macros... so you can add it to the QAT )
 
Thank you. I already added the command to view the macros per what you mentioned.

Is there anyway to display the macro names with spaces between the words of the title...as when you view macros, its the formal name of each macro.

Thank you.
 
No, it only shows the procedure name. You can use underscores in the names to mimic spaces. If you put the macro in a module it should show just the procedure name, not 'thisoutlooksession.macroname'
 
Got it all......thank you....and the only new problem is after I create the new menu to the home page of the outlook, and I add the macros to it....it works.....but after I close Outlook and open it up again, the new menu is gone....

How do I fix that please? I appreciate you advice very much as the macros are wonderful.
 
It sounds like the outlook isn't closing correctly so its not getting saved, but i'm not sure which screen you are referring to. Can you post a screenshot of what it looks like before you close outlook so I know we are on the same page?
 
Thank you very much again. I found out that the place I placed was not the right place, did it again to the toolbar and it saved!

Another very important question given you have helped me so much!!

We had the macro that I click in after I single click a contact or open up the contact, which goes to a certain e-mail template and autumatically identifies and add the e-mail address of the contact, which you sent me re the notepad and it works great.

Do you have a macro that will identify the contact e-mail if I click on the contact or open up the contact, and then it will autumatically search all e-mail folders for emails to for from that contact, and show them up in the list to review.

I can do that research under outlook just searching all folders and putting the email address to search for, but would very like to do it from the contact itself whether I open it or open it, and than when I am at the contact however I am there, I can do that immediate search of alll email folders re the email address of the contact.

That would be great.

Thanks very much.
 
The instant search for messages from a contact is another perfect macro that works if I click on contact or open the contact.

Howerver, its does not add to the search all the email to that contact...ie, what I sent to them.....

So can we add to the macro so that is show both what I received and what I sent to them...cause in the to part of outlook if you search and your have set up to search all folders not just the one you are in, it show both what was send and what was received...

So is there something you can add to the macro so it does both.....as I am excited to add the bullot point to the contact and to new menu of opening of outlook.

Thanks so very very much. You are the best!!
 
The search string uses the same criteria you'd type in the Instant Search box, so it can search for anything you can search for.

txtSearch = "from:" & strFilter

would become

txtSearch = "from:" & strFilter & " OR to:" & strFilter
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
S Macro for other actions - Outlook 2007 Outlook VBA and Custom Forms 23
L Outlook 2007 - Macro Re Search Using Outlook 16
L Outlook 2007 Macro to Contact From a Field Using Outlook 3
L Outlook 2007 Macro Save Contact Using Outlook 10
L Outlook 2007 Macro Reply to E-mail Using Outlook 16
L Outlook 2007 Macro Search Contacts Using Outlook 9
L Outlook 2007 Macro to LinkedIn Using Outlook 3
L Outlook 2007 Macro Open Contact Folder Using Outlook 7
L Macro to Open a Specific Word Document - Outlook 2007 Using Outlook 17
L Outlook 2007 Macro For Views Using Outlook 10
L Outlook 2007 Macro to Run a Script From a Contact Form Using Outlook 41
L Outlook 2007 Macro to Add Text to a Contact Field Using Outlook 10
F Help with Outlook 2007 Macro Please! Using Outlook 4
D outlook 2003/2007 macro query Using Outlook 2
O Macro for creating hyperlinks in Outlook 2007 Using Outlook 3
S Outlook 2007 Macro for replying to an e-mail. Outlook VBA and Custom Forms 1
J Can't run macro Outlook 2007 that was created in Word 2007 Outlook VBA and Custom Forms 1
I Creating an Outlook 2007 macro that attaches a signature to new me Outlook VBA and Custom Forms 1
L Help for writing an Outlook 2007 macro Outlook VBA and Custom Forms 7
D Insert Text via Macro in Outlook 2007 Outlook VBA and Custom Forms 2
G Outlook 2007 Macro: Paste - Paste Special - Unformatted Text Outlook VBA and Custom Forms 9
C After Office 2007 SP2 install - Outlook 2007 macro no longer worki Outlook VBA and Custom Forms 11
R Anyone have a sample macro for Outlook 2007 (setting the zoom)? Outlook VBA and Custom Forms 1
S Outlook 2007: automating form with macro Outlook VBA and Custom Forms 2
S How to create a macro to insert a signature in Outlook 2007 Outlook VBA and Custom Forms 1
D Outlook 2007 Recovering E-Mails Using Outlook 0
W Transfer Outlook 2016 autocomplete file to Outlook 2007 Using Outlook 1
C Outlook 2007 Removing then adding account restores junk email processing Using Outlook 0
S Outlook 2007 crash linked to gdiplus.dll Using Outlook 0
S Outlook 2007 - Automatic purge fail Using Outlook 0
J outlook 2007 doesn't let me choose which .pst to search Using Outlook 2
D Outlook 2007 vs. Outlook 2010 -- ToDo Bar Using Outlook 0
D Outlook 2007 on 365 Using Outlook.com accounts in Outlook 2
S Verwendung von Outlook 2007 Using Outlook 0
A Arthur needs help with 2007 Outlook e-mail Using Outlook.com accounts in Outlook 3
M PST import from Outlook 2007 to 2010 - Address Book contacts all in 1 group Using Outlook 4
S outlook 2007 calendar search Using Outlook 6
B Migrate Outlook 2007 to Office 365 Using Outlook 3
X I have met my waterloo trying to resolve embedded graphics problem with outlook 2007 and now 2016 Using Outlook 1
R Outlook 2007 only loads some appointments Using Outlook 0
C Move Outlook 2007 to new PC with Outlook 365 Using Outlook 3
J Outlook 2007 Hide Messages Option not Available Using Outlook 2
S Outlook 2007 Calendar instant search problem. Windows 7 Using Outlook 4
S Outlook 2007 Calendar instant search problem. Windows 7 Using Outlook 0
B Server errors Outlook 2007 Using Outlook 1
S Reboot of frozen windows7 results in changed outlook 2007 settings Using Outlook 1
S Outlook 2007 printing wrong email address at top of page Using Outlook 8
M Configure outlook 2007 to accept digital signatures Using Outlook 2
D Outlook 2007 crashes when opening an email Using Outlook 2
R New chap saying hello and needing advice on Outlook 2007 thumbnails Using Outlook 3

Similar threads

Back
Top