PDA

View Full Version : Signatures



steve
11-09-2005, 06:01 AM
HiDoes anyone know if theres a way of prompting the user to add a signature or not? We are currently upgrading to Outlook 2003 from GroupWise 5.5 and in GroupWise you have the option to prompt you to insert a signature when you click send (on any new reply or forward mail) on it asks you to either add or dont add signature, which a lot of people found useful. Is there anyway of doing this in Outlook even using VBA??ThanksSteve

Ken Puls
11-09-2005, 07:20 AM
...We are currently upgrading to Outlook 2003 from GroupWise 5.5 ...

Uh... upgrading? I use both products daily (Groupwise at work, Outlook at home) and to my mind, Groupwise will actually do FAR more than Outlook, no question.

From being it's own mail server, to document library management to the actual email itself, Groupwise wins in sheer capabilities. Outlook's only advantage is that it's a little more mainstream, and that it integrates tightly with the office suite. To get the rest of the features that Groupwise has, you'll need to add an exchange server at a mimimum.

Regardless, as far as signatures go, I don't know if I can help you there... I know the feature you mean in Groupwise, but I just set up Outlook to tag it. I almost always use one, and never checked to see if there was a prompting feature. Curious to know myself, now that you mention it. If no one else answers, I'll dig around a little when I get home tonight.

:)

chocobochick
11-09-2005, 01:37 PM
I'm only running Outlook 2000, but I cannot find a similar feature. You can either set it to automatically add a default signature all the time (except maybe on forwards and replies), or you can leave the setting off and do it yourself by selectin Insert / Signature from the menu each time you create a new email.

As far as programming a feature like this, it is possible. Outlook doesn't provide programatic access to the saved signatures created by your user profile, but it does provide access to the Insert menu you use to add one.

The following code works in Outlook 2000, although it may need adjustments for 2003 if the menus are any different. To use it, open Outlook, open the VB Editor (ALT+F11), double-click ThisOutlookSession, and paste the code.

' Code for signature prompt on new email messages

Private WithEvents myOlInspectors As Outlook.Inspectors ' Inspectors collection
Private WithEvents myOlInspector As Outlook.Inspector ' New inspector

' Assign Inspectors collection to catch events
Private Sub Application_Startup()
Set myOlInspectors = Application.Inspectors
End Sub

' Assign newly created Inspector to catch Activate event
Private Sub myOlInspectors_NewInspector(ByVal Inspector As Outlook.Inspector)
If Inspector.CurrentItem.Class = olMail Then Set myOlInspector = Inspector
End Sub

' Prompt user to consider adding a signature
Private Sub myOlInspector_Activate()
Dim result As Integer ' Store user response from prompt
DoEvents ' Give inspector window time to load
result = MsgBox("Would you like to add a signature to this email?", vbYesNo, "Add Signature?")
If result = vbYes Then _
myOlInspector.CommandBars("Menu Bar").Controls("Insert").Controls("Signature").Controls("More...").Execute
Set myOlInspector = Nothing ' Prevent Outlook from acting on Activate event from this Inspector again
End Sub

Private Sub Application_Quit()
Set myOlInspectors = Nothing ' Remove reference to Inspectors collection
End Sub

Ken Puls
11-09-2005, 05:11 PM
Hi Chocobochick,

I gave this a shot in 2003, but can't see that it made any difference. One question as I have signatures tagged automatically... will it be ignored if the signatures are already active?

steve
11-10-2005, 02:57 AM
Hi

Chocobochick - Thanks for the code, gave it a try today and nothing happened. When I sent the e-mail it didnt prompt to add the signature. Any ideas?

Kpuls - I personally have always been a fan of Outlook, but that was before I realised quite how much GroupWise can do! Although this seems like a silly little function its suprising how handy it is and how many people use it. I shall keep working on it.

Shellgrip
11-10-2005, 04:42 AM
As it happens I have a signature request as well! We occasionally want to print off some of our custom forms but since virtually everyone here has an automatic signature insertion we're getting signatures at the bottom of the prints. In fact for some reason I haven't fathomed, we're getting two copies of the signature.

It's no biggy, but is there not some way of completly surpressing the signature? I would have thought it was added to the Message field but these forms don't have one (it was deleted during design) so where is this sig coming from?

Jon

chocobochick
11-10-2005, 10:30 AM
I had the opportunity to browse Outlook 2003 on an XP machine today, and the Insert / Signatures command is not there on the menu, rendering my code useless for that machine. However, I think I saw a similar command available from the Options dropdown in the Email toolbar. Perhaps someone with more available access to Outlook 2003 can adjust the line in my code to work with this.

As far as suppressing printed signatures, I'm not sure there are any simple options. I'm not sure where they're appearing on your custom forms, but the signatures get placed into the Body property (and possibly HTMLBody property) of a MailItem object, and once it's there, there's no way to differentiate between it and any other manually typed text.

Ken Puls
11-10-2005, 10:59 AM
Heya Chocobo,

I'm not much of an Outlook coder, but I'll see if I can sleuth around in it a bit when I get the chance. :)

chocobochick
11-10-2005, 12:26 PM
This line:

myOlInspector.CommandBars("Menu Bar").Controls("Insert").Controls("Signature").Controls("More...").Execute


...needs to be changed in the above code to match the location of the Signature button in the Email toolbar. The strings in Quotes just have to match the caption used for each step of the process, so it would probably look something like:

myOlInspector.CommandBars("Email").Controls("Options...").Controls("Signature").Execute

Shellgrip
11-11-2005, 04:27 AM
Thanks Choco. However, if I want no signature, wouldn't that mean setting everyone up with a blank signature to choose?

I'm closer by addressing the HTMLBody property. Unfortunately, setting this to "" on the Open event isn't working because the Sig is being added after this open event (tested by setting HTMLBody to some text - it appears beneath the sig).

I can cure my other custom form (where the body isn't actually used) by setting it to "" on closing but I had planned to use the Body in this one so that wouldn't be a useful option :saywhat:

I'll do some more playing. Thanks for the help so far - keep it coming!

Jon

steve
11-11-2005, 05:10 AM
Hi Choco!

I've done what you said and it doesnt work! :banghead: It doesnt prompt me to add a signature at all just sends the e-mail!

Thanks for your help so far!

Steve

chocobochick
11-11-2005, 06:15 AM
Oops. I neglected to mention that you will need to completely close and restart Outlook after you've pasted the code.

steve
11-11-2005, 06:53 AM
Done that...Still not working. Just to check I opened VBA editor double clicked ThisOutlookSession and just pasted the code in there (see attached screen shot)

Thanks
Steve

chocobochick
11-11-2005, 07:07 AM
The code is not going to properly bring up your sig options in Outlook 2003 (someone else will need to post the corrected code for that), but you should at least be getting the prompt displayed each time you hit the New Mail Message button. If you're not getting the prompt, Outlook may have macro settings disabled.

steve
11-11-2005, 07:15 AM
Opps does help if I sent the Macro security to medium! :rotlaugh:

Works perfectly now thanx

Steve