Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Installing outlook code

Posted on 2011-02-11
26
872 Views
Last Modified: 2012-05-11
i need to get this installed so i can be prompted which outlook account to send from before i send.
http://www.daniel-mitchell.com/2007/08/03/outlook-2007-prompt-for-user-account-when-sending-email/

Open in new window


i need the step by step instructions prior to where these starts
0
Comment
Question by:g11media
  • 14
  • 5
  • 4
  • +2
26 Comments
 
LVL 13

Expert Comment

by:BCipollone
ID: 34876481
Right click ribbon > Customize Ribbon > All Commands > Macros > Add >> 

May need to create a custom group to add this command to...

After it is added click on Macros v > Macros

Input the name and Code then the next time you click on macros it should appear in the drop down list.
0
 

Author Comment

by:g11media
ID: 34876559
what "ribbon" where do i find the ribbon?
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 34876724
What version of outlook?
0
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 

Author Comment

by:g11media
ID: 34876745
2007
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 34876780
In outlook select alt + F11

In the Visual Basic Editor, (VBE) press ctrl + R.  You should see a window "Project" or the likes..  In this window expand:

Project as displayed to reveal MS outlook objects and expand this to display thisOutlookSession.

Paste the code in this module.  Now check security

In the application select Tools | Macro | Security
      : Outlook Application - Warnings for all Macros

Exit outlook and save the project as you do so.

Re-open outlook and does it work?

Chris
0
 
LVL 13

Expert Comment

by:Chris Raisin
ID: 34878538
I  tested it and it worked, but don't forget to create the form as well.

Click (from the code menu) "Insert/User Form" then insert the code in the second part of the instructions into the body of the form you have created.

The two buttons are "Cancel" on left and "Send" on Right. and the wording above the textbox area is "Select an Account for Sent Item:" (hard to see in the diagram)

I have created a complete step by step tutorial if you need it.
0
 
LVL 13

Expert Comment

by:Chris Raisin
ID: 34879135
By the way, the code will only work in 2007 (or later) because it makes use of the Outlook objects "Account" instance variable, which does not exist in versions of Outlook earlier than 2007. There is no work-around to access account information or change accounts on outward email items in 2003, unfortunately.

You will have to read all the added notes after the code given in the link. It highlights changing the names of form objects etc.

I have a tutorial that describes step by step how to achieve your requirement, although I created it in Outlook 2003 (the procedure is probably the same in Outlook 2007). It was disappointing it did not work in 2003, but there you go!
0
 
LVL 13

Expert Comment

by:Chris Raisin
ID: 34892260
I will put the tutorial up this afternoon (in about 6 hours)
0
 
LVL 13

Expert Comment

by:Chris Raisin
ID: 34893655
Sorry...still orking on the tutorial...will upload this afternoon.
Stand by....
0
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
ID: 34895513
Hi, g11media.

There's a much simpler means of doing this that requires far less code and doesn't involve creating a form.  That is to display a dialog-box each time you send that reminds you which account you're sending through and giving you the option to cancel the send and switch accounts.  Here's the code.  Follow these instructions to add it to Outlook.

1.  Start Outlook
2.  Click Tools > Macro > Visual Basic Editor
3.  If not already expanded, expand Microsoft Office Outlook Objects and click on ThisOutlookSession
4.  Copy the code from the Code Snippet box and paste it into the right-hand pane of Outlook's VB Editor window
5.  Edit the code as needed.  I included comment lines wherever something needs to or can change
6.  Click the diskette icon on the toolbar to save the changes
7.  Close the VB Editor
8.  Click Tools > Trust Center
9.  Click Macro Security
10. Set Macro Security to "Warnings for all macros"
11. Click OK
12. Close Outlook
13. Start Outlook.  Outlook will display a dialog-box warning that ThisOutlookSession contains macros and asking if you want to allow them to run.  Say yes.

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    If msgbox("Are you sure you want to send them message through the " & Item.SendUsingAccount & " account?", vbYesNo + vbApplicationModal, "Verify Sending Account") = vbNo Then
        Cancel = True
    End If
End Sub

Open in new window

0
 
LVL 13

Expert Comment

by:Chris Raisin
ID: 34895565
That is a nice simple solution BlueDevilFan.

Again it will only work in Outlook 97 or later (which is finr for g11media (th author) I am sure.

Since I have put a lot of work into the tutorial , g11media, do you still want me to upload it?

Cheers
craisin (Chris)
0
 
LVL 13

Expert Comment

by:Chris Raisin
ID: 34895610
Oops! That should read "Outlook 2007" not Outlook 97...sorry!
0
 
LVL 76

Expert Comment

by:David Lee
ID: 34901375
Hi, craisin.

Thanks.  You're correct.  The code I uploaded will only work for Outlook 2007 and later.  I'd like to see the tutorial you've put together.
0
 

Author Comment

by:g11media
ID: 34913108
PLEASE put tutorial up. Thank you! looking forward to getting this done tonight. i have been traveling, so sorry for delay in responding.
0
 
LVL 13

Expert Comment

by:Chris Raisin
ID: 34913148
OK...shall do...Keep your eyes open for tutorial. I am undergoing lasewr surgery on my left eye today so there will be a couple of days delay....Stay tuned though  :-)
0
 
LVL 13

Expert Comment

by:Chris Raisin
ID: 34913161
Is a powerpoint presentation OK (PPS/PPT) ?
0
 

Author Comment

by:g11media
ID: 34913246
sure
0
 
LVL 13

Expert Comment

by:Chris Raisin
ID: 34913312
I will try to do it this avo before I go into surgery
0
 
LVL 13

Expert Comment

by:Chris Raisin
ID: 34913851
OK, here it is.

There may be a few typos, but I have run out of time.

Remember, this was created in Outlook 2003 so the environment may be a little different to Oylook 2007, and the macro will only run in Outlook 2007 or later.

Sorry that the coide is a blue color (haven't got time to recapture the scren with easier to see code).

Basically it is the code already contained in the article you referenced on the website at the top of this question. I added a little bit to enable the user to double-click the account when the selection box pops up rather than having to select then click a button.

Let me know if you find any errors, and when my eye gets better (I hope) I will fix any problems.

Cheers...Chris (craisin)
InstallingOutlookCode.ppt
0
 
LVL 13

Expert Comment

by:Chris Raisin
ID: 34913864
Oops! Only the first slide is there...let me try again...

InstallingOutlookCode.ppt
0
 
LVL 76

Expert Comment

by:David Lee
ID: 34914624
Nicely done, Chris (craisin)!  I hope the eye surgery went well, or goes well if you haven't had it done yet.  
0
 

Author Comment

by:g11media
ID: 34917215
so bluedevilfan, the solution you provided work well, but i am finding that it is freezing my outlook. I am troubleshooting it, but just thought i would mention that to see if anyone else is having any issue.
0
 
LVL 13

Expert Comment

by:Chris Raisin
ID: 34917240
Have you tried my soilution? The code is for Outlook 2007 or later.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 34921187
Freezing Outlook in what way?  The code is only invoked when something is sent.  It's impossible for it to affect Outlook at any other time.  I use the same code on my system and I haven't noticed any problems.
0
 
LVL 13

Expert Comment

by:Chris Raisin
ID: 34922974
Yes, I cannot see any reason why BlueDevilFan's code should not work UNLESS you are using a version of Outlook earlier than Outlook 97. Then it definately will freeze outlook (oputlook does not display an error for invalud macro execution unless the VBEditor is open).
0
 
LVL 13

Expert Comment

by:Chris Raisin
ID: 34922979
g11media,

I rushed the tutorail for you before my eye operation. Was it of interest?

(By the way, the operation was a complete success....the only thing that hurt was my wallet!)
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question