PC Review
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook VBA Programming
idiot's guide to running a script...
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook VBA Programming
idiot's guide to running a script...
![]() |
idiot's guide to running a script... |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
dear all,
apologies in advance, but am a complete VBA newbie. I'd like to auto-BCC all my emails. i've looked through the web, and found several links on how to do this, using VBA: http://groups.google.com/group/micr...101740e3454ea1d and http://www.outlookcode.com/d/code/autobcc.htm i've used the approach described here: www.outlookcode.com/article.aspx?id=49 now, once again, apologies (must sound like a _real_ newbie, which i am!), but the problem i have is that i don't know how to actually 'run' the code. here are the steps I take: set the trust center to warn on all macros. in outlook 2007, alt+f11, which opens up VBA. double click on 'this outlook session'. double click on microsoft office outlook objects, to expand it. double click on 'ThisOutlookSession'. paste in the following code on the right: Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) Dim objMe As Recipient Set objMe = Item.Recipients.Add("myemail@email.com") objMe.Type = olBCC objMe.Resolve Set objMe = Nothing End Sub now: when I press F5 in VBA, or alt-F8 in outlook, i get asked for what macro I want to run - the list is empty however. (assuming I did manage to get it to appear as a macro, would there be any way to automate this - ie so that every message automatically does a BCC with an email address, without me having to run the macro each time?). just FYI, upon restarting outlook i did get a dialogue to approve 'thisoutlooksession', which i did. but i still don't know what to do do actually make it work/run it. any help would be gratefully received! |
|
|
|
#2 |
|
Guest
Posts: n/a
|
F5 runs a macro. The procedure you're using isn't a macro. It's an event handler. It runs automatically when the user sends an item.
Did you follow the suggested steps at http://outlookcode.com/article.aspx?id=49 to set your macro security option and create and test the HelloWorld macro? If not, I'd recommend that you do so. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "llama thumper" <spam@redo.net> wrote in message news:f9f9cc41-13ec-45f2-a81f-78cb14098dc4@j44g2000hsj.googlegroups.com... > dear all, > > apologies in advance, but am a complete VBA newbie. > > I'd like to auto-BCC all my emails. > > i've looked through the web, and found several links on how to do > this, using VBA: > > http://groups.google.com/group/micr...101740e3454ea1d > > and > > http://www.outlookcode.com/d/code/autobcc.htm > > i've used the approach described here: > www.outlookcode.com/article.aspx?id=49 > > now, once again, apologies (must sound like a _real_ newbie, which i > am!), but the problem i have is that i don't know how to actually > 'run' the code. > > here are the steps I take: > > set the trust center to warn on all macros. > > in outlook 2007, alt+f11, which opens up VBA. double click on 'this > outlook session'. > double click on microsoft office outlook objects, to expand it. > double click on 'ThisOutlookSession'. > paste in the following code on the right: > > Private Sub Application_ItemSend(ByVal Item As Object, Cancel As > Boolean) > Dim objMe As Recipient > Set objMe = Item.Recipients.Add("myemail@email.com") > objMe.Type = olBCC > objMe.Resolve > Set objMe = Nothing > End Sub > > now: when I press F5 in VBA, or alt-F8 in outlook, i get asked for > what macro I want to run - the list is empty however. > > (assuming I did manage to get it to appear as a macro, would there be > any way to automate this - ie so that every message automatically does > a BCC with an email address, without me having to run the macro each > time?). > > just FYI, upon restarting outlook i did get a dialogue to approve > 'thisoutlooksession', which i did. but i still don't know what to do > do actually make it work/run it. > > any help would be gratefully received! |
|
|
|
#3 |
|
Guest
Posts: n/a
|
many thanks for your reply.
i 've followed the steps: with the code given in the link pasted in, i press F5 and the test message appears. when i try the BCC code and press F5 I get prompted to run a macro... ? |
|
|
|
#4 |
|
Guest
Posts: n/a
|
As I told you earlier the Bcc code isn't a macro. You can't run it with F5. You have to wait for the ItemSend event to fire. Since you've tested your VBA setup and put the code in the ThisOutlookSession module, it should run fine when you send a message. If not, test your VBA setup with the hello world macro to make sure VBA is running OK.
-- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 <piotr.redo@gmail.com> wrote in message news:0420b39f-de8f-4e3f-a9d6-9da821f9b340@d27g2000prf.googlegroups.com... > many thanks for your reply. > > i 've followed the steps: > > with the code given in the link pasted in, i press F5 and the test > message appears. > > when i try the BCC code and press F5 I get prompted to run a > macro... ? > |
|
|
|
#5 |
|
Guest
Posts: n/a
|
Many thanks - have got it running now.
|
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

