WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Cancelling ItemSend event removes signature tag?

 
Goto page 1, 2
   Home -> Office -> Programming VBA RSS
Next:  Trapping RDO (Redemption) Events in Delphi  
Author Message
Josh

External


Since: Oct 23, 2008
Posts: 12



(Msg. 1) Posted: Sun Oct 26, 2008 7:13 am
Post subject: Cancelling ItemSend event removes signature tag?
Archived from groups: microsoft>public>outlook>program_vba (more info?)

I have code that verifies the sending account before a message is
sent. So in the Application_ItemSend event, it will display "Are you
sure you want to send using account-name." If you click no, it will
set Cancel=True. This gives the user the opportunity to change to the
correct account. The problem is that this process somehow removes the
special bookmark used for the signature. So, even if I manually update
the account using the account dropdown, the signature won't update. As
further proof, if I go to Insert -> Signature and select one, it will
insert a second signature on the email (as opposed to replacing the
existing one).

Any thoughts on why this is happening or how to prevent it?

Thanks,
Josh
Back to top
Login to vote
Ken Slovak - [MVP - Outlo

External


Since: Oct 17, 2003
Posts: 2898



(Msg. 2) Posted: Mon Oct 27, 2008 9:16 am
Post subject: Re: Cancelling ItemSend event removes signature tag? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Outlook version and email editor used?

In general that event is way too late to change signatures. You would have
to do it before the item is sent to the email transport, or you'd have to
find the bookmark and change the signature yourself in code based on the
sending account.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Josh" <jgordon428 RemoveThis @gmail.com> wrote in message
news:d3e5042d-08b6-4936-beac-10d3e16b7cfe@l62g2000hse.googlegroups.com...
>I have code that verifies the sending account before a message is
> sent. So in the Application_ItemSend event, it will display "Are you
> sure you want to send using account-name." If you click no, it will
> set Cancel=True. This gives the user the opportunity to change to the
> correct account. The problem is that this process somehow removes the
> special bookmark used for the signature. So, even if I manually update
> the account using the account dropdown, the signature won't update. As
> further proof, if I go to Insert -> Signature and select one, it will
> insert a second signature on the email (as opposed to replacing the
> existing one).
>
> Any thoughts on why this is happening or how to prevent it?
>
> Thanks,
> Josh
Back to top
Login to vote
Josh

External


Since: Apr 19, 2006
Posts: 80



(Msg. 3) Posted: Mon Oct 27, 2008 9:16 am
Post subject: Re: Cancelling ItemSend event removes signature tag? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Sorry, using Outlook 2007. I'm not actually trying to change the
account/signature in the ItemSend event. I'm just doing some confirmation and
then sometimes canceling the send. Once i cancel, I'm looking at the unsent
email in Outlook again and just trying to manually update the
account/signature.

How can I capture the event of someone trying to send an email before it
gets to the ItemSend event? If there's not a way of doing that, how could I
modify the signature using bookmarks? As I mentioned, it seems to me that
something about calling the ItemSend event and then canceling it blows away
the bookmark, as Outlook can't even modify the signature through the GUI
after that occurs.

Thanks,
Josh


"Ken Slovak - [MVP - Outlook]" wrote:

> Outlook version and email editor used?
>
> In general that event is way too late to change signatures. You would have
> to do it before the item is sent to the email transport, or you'd have to
> find the bookmark and change the signature yourself in code based on the
> sending account.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Professional Programming Outlook 2007.
> Reminder Manager, Extended Reminders, Attachment Options.
> http://www.slovaktech.com/products.htm
>
>
> "Josh" <jgordon428.TakeThisOut@gmail.com> wrote in message
> news:d3e5042d-08b6-4936-beac-10d3e16b7cfe@l62g2000hse.googlegroups.com...
> >I have code that verifies the sending account before a message is
> > sent. So in the Application_ItemSend event, it will display "Are you
> > sure you want to send using account-name." If you click no, it will
> > set Cancel=True. This gives the user the opportunity to change to the
> > correct account. The problem is that this process somehow removes the
> > special bookmark used for the signature. So, even if I manually update
> > the account using the account dropdown, the signature won't update. As
> > further proof, if I go to Insert -> Signature and select one, it will
> > insert a second signature on the email (as opposed to replacing the
> > existing one).
> >
> > Any thoughts on why this is happening or how to prevent it?
> >
> > Thanks,
> > Josh
>
>
Back to top
Login to vote
Ken Slovak - [MVP - Outlo

External


Since: Oct 17, 2003
Posts: 2898



(Msg. 4) Posted: Mon Oct 27, 2008 9:59 am
Post subject: Re: Cancelling ItemSend event removes signature tag? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

You said you were using the Application_ItemSend() event, try using the
Item.Send() event which occurs before Application_ItemSend(). If that
doesn't work then you can't do what you want to do.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Josh" <Josh DeleteThis @discussions.microsoft.com> wrote in message
news:D8EEBF08-2C53-4558-9A03-6F722AA3F085@microsoft.com...
> Sorry, using Outlook 2007. I'm not actually trying to change the
> account/signature in the ItemSend event. I'm just doing some confirmation
> and
> then sometimes canceling the send. Once i cancel, I'm looking at the
> unsent
> email in Outlook again and just trying to manually update the
> account/signature.
>
> How can I capture the event of someone trying to send an email before it
> gets to the ItemSend event? If there's not a way of doing that, how could
> I
> modify the signature using bookmarks? As I mentioned, it seems to me that
> something about calling the ItemSend event and then canceling it blows
> away
> the bookmark, as Outlook can't even modify the signature through the GUI
> after that occurs.
>
> Thanks,
> Josh
Back to top
Login to vote
Josh

External


Since: Apr 19, 2006
Posts: 80



(Msg. 5) Posted: Mon Oct 27, 2008 9:59 am
Post subject: Re: Cancelling ItemSend event removes signature tag? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Ken,

Thanks for the reply. I'm sorry but I'm not sure how to handle the
Item.Send() event. I read some of your other posts, like this one:
1. Declare at class level an ItemEvents_Event object, say _apptEvents:
private Outlook.ItemEvents_Event _apptEvents;

Then instantiate the event handler so:
_apptEvents = (Outlook.ItemEvents_Event)_appt;
_apptEvents.Send += new Outlook.ItemEvents_SendEventHandler(myHandler);

but I don't see the Outlook.ItemEvents_Event in intellisense.

Thanks,
Josh

"Ken Slovak - [MVP - Outlook]" wrote:

> You said you were using the Application_ItemSend() event, try using the
> Item.Send() event which occurs before Application_ItemSend(). If that
> doesn't work then you can't do what you want to do.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Professional Programming Outlook 2007.
> Reminder Manager, Extended Reminders, Attachment Options.
> http://www.slovaktech.com/products.htm
>
>
> "Josh" <Josh.TakeThisOut@discussions.microsoft.com> wrote in message
> news:D8EEBF08-2C53-4558-9A03-6F722AA3F085@microsoft.com...
> > Sorry, using Outlook 2007. I'm not actually trying to change the
> > account/signature in the ItemSend event. I'm just doing some confirmation
> > and
> > then sometimes canceling the send. Once i cancel, I'm looking at the
> > unsent
> > email in Outlook again and just trying to manually update the
> > account/signature.
> >
> > How can I capture the event of someone trying to send an email before it
> > gets to the ItemSend event? If there's not a way of doing that, how could
> > I
> > modify the signature using bookmarks? As I mentioned, it seems to me that
> > something about calling the ItemSend event and then canceling it blows
> > away
> > the bookmark, as Outlook can't even modify the signature through the GUI
> > after that occurs.
> >
> > Thanks,
> > Josh
>
>
Back to top
Login to vote
Ken Slovak - [MVP - Outlo

External


Since: Oct 17, 2003
Posts: 2898



(Msg. 6) Posted: Tue Oct 28, 2008 9:27 am
Post subject: Re: Cancelling ItemSend event removes signature tag? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

That example uses C#, from what you've posted I assume you are using VBA
code, which is completely different. In that case the item will directly
expose the Send() event, so if you have a MailItem as objMail then
objMail.Send() will refer both to the Send() method and the Send() event.

For VBA code you would need to declare your item object (objMail say)
WithEvents so you can handle events on that item.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Josh" <Josh.RemoveThis@discussions.microsoft.com> wrote in message
news:D4BDB276-5A59-4D38-8299-D48448084987@microsoft.com...
> Ken,
>
> Thanks for the reply. I'm sorry but I'm not sure how to handle the
> Item.Send() event. I read some of your other posts, like this one:
> 1. Declare at class level an ItemEvents_Event object, say _apptEvents:
> private Outlook.ItemEvents_Event _apptEvents;
>
> Then instantiate the event handler so:
> _apptEvents = (Outlook.ItemEvents_Event)_appt;
> _apptEvents.Send += new Outlook.ItemEvents_SendEventHandler(myHandler);
>
> but I don't see the Outlook.ItemEvents_Event in intellisense.
>
> Thanks,
> Josh
Back to top
Login to vote
Josh

External


Since: Apr 19, 2006
Posts: 80



(Msg. 7) Posted: Tue Oct 28, 2008 9:27 am
Post subject: Re: Cancelling ItemSend event removes signature tag? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Ken, thanks for the reply. I did as you said, and it is capturing the
objMail_Send event prior to Application_ItemSend. However, it is still
experiencing the same problem with the signature not updating/not being
updateable.

Also, I have in ThisOutlookSession:
Public WithEvents objMail As MailItem
Private Sub Application_ItemLoad(ByVal Item As Object)
If TypeOf Item Is Outlook.MailItem Then
Set objMail = Item
End If
End Sub

Is this the correct place to put this code? How do I handle if multiple
message are opened at once? Seems like it could get a handle to the wrong
item when sending.

-Josh
"Ken Slovak - [MVP - Outlook]" wrote:

> That example uses C#, from what you've posted I assume you are using VBA
> code, which is completely different. In that case the item will directly
> expose the Send() event, so if you have a MailItem as objMail then
> objMail.Send() will refer both to the Send() method and the Send() event.
>
> For VBA code you would need to declare your item object (objMail say)
> WithEvents so you can handle events on that item.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Professional Programming Outlook 2007.
> Reminder Manager, Extended Reminders, Attachment Options.
> http://www.slovaktech.com/products.htm
>
>
> "Josh" <Josh.TakeThisOut@discussions.microsoft.com> wrote in message
> news:D4BDB276-5A59-4D38-8299-D48448084987@microsoft.com...
> > Ken,
> >
> > Thanks for the reply. I'm sorry but I'm not sure how to handle the
> > Item.Send() event. I read some of your other posts, like this one:
> > 1. Declare at class level an ItemEvents_Event object, say _apptEvents:
> > private Outlook.ItemEvents_Event _apptEvents;
> >
> > Then instantiate the event handler so:
> > _apptEvents = (Outlook.ItemEvents_Event)_appt;
> > _apptEvents.Send += new Outlook.ItemEvents_SendEventHandler(myHandler);
> >
> > but I don't see the Outlook.ItemEvents_Event in intellisense.
> >
> > Thanks,
> > Josh
>
>
Back to top
Login to vote
Ken Slovak - [MVP - Outlo

External


Since: Oct 17, 2003
Posts: 2898



(Msg. 8) Posted: Tue Oct 28, 2008 10:51 am
Post subject: Re: Cancelling ItemSend event removes signature tag? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

That's the correct location. For multiple open Inspectors or items you can
use a collection to hold them and a unique Key value for each one. I usually
use a special wrapper class that declares any item or Inspector objects I'll
need along with the event handlers for the specific item. Then each item's
events fire only in that class. The collection keeps the class alive until
it's no longer needed, you just remove it from the collection when the item
or Inspector is closed.

As I mentioned, that might not work since the signature stuff is only done
by Outlook when a new item is opened/replied to/forwarded. For anything else
it becomes a matter of finding the existing signature and replacing it
yourself with the desired one using string functions.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Josh" <Josh DeleteThis @discussions.microsoft.com> wrote in message
news:67E08B7E-BBB3-4D05-B7FF-D5CD6E73B1DD@microsoft.com...
> Ken, thanks for the reply. I did as you said, and it is capturing the
> objMail_Send event prior to Application_ItemSend. However, it is still
> experiencing the same problem with the signature not updating/not being
> updateable.
>
> Also, I have in ThisOutlookSession:
> Public WithEvents objMail As MailItem
> Private Sub Application_ItemLoad(ByVal Item As Object)
> If TypeOf Item Is Outlook.MailItem Then
> Set objMail = Item
> End If
> End Sub
>
> Is this the correct place to put this code? How do I handle if multiple
> message are opened at once? Seems like it could get a handle to the wrong
> item when sending.
>
> -Josh
Back to top
Login to vote
Display posts from previous:   
       Home -> Office -> Programming VBA All times are: Eastern Time (US & Canada) (change)
Goto page 1, 2
Page 1 of 2

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Categories:
 Windows XP
 Windows Vista
 Windows Other
  Office
 Office Other
 Security
 WinRAR
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET