Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    May 2001
    Location
    Wellington
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Outlook VBA Send probs (Outlook 2k/xp)

    I got really annoyed with Outlook yesterday, and thought of a solution to my problems, then got stuck implementing them. I'd be pleased to hear if anyone has some good ideas.

    The first thing is I want to be able to choose whether or not to add a signature to the message. Ideally, access to a list of sigs would be possible, but I don't know what sort of programmatic access to the sigs exists.

    I'm not sure either if I have a way to slip the sig into the message before it is actually sent, or do I have to cancel the event, add it, and then resend?

    Once that is all working, I'd like to add a good old-fashioned tagline selection mechanism. Ah, the old days...

    Jim

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Outlook VBA Send probs (Outlook 2k/xp)

    > I'm not sure either if I have a way to slip the sig into the message before it is actually sent, or do I
    > have to cancel the event, add it, and then resend?

    Adding text at the end of the message isn't a big deal:

    myMessage.Body = myMessage.Body & strSignature

    (This is for plain text; I'm not sure whether the HTMLBody behaves the same way - presumably it has tags in it.) Since Outlook messages are a big blob of text, trying to correctly position new text into them other than at the very beginning or end is a hassle.

    As a test, I added this to an existing Class Module named OLMI:

    Private Sub myOLMI_Send(Cancel As Boolean)
    Set myMailItem = ActiveInspector.CurrentItem
    myMailItem.Body = "HELLO DUDE!!" & vbCrLf & myMailItem.Body
    End Sub

    As expected, a message I sent to myself was prefaced on the first line with HELLO DUDE!!

    Unfortunately, it has been so long since I set up these class modules that I couldn't tell you all the pieces of plumbing that make them work. Hope this helps anyway.

  3. #3
    Lounger
    Join Date
    May 2001
    Location
    Wellington
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Outlook VBA Send probs (Outlook 2k/xp)

    Thanks, that was most helpful. I think I'm at the crux of the problem now though. The signatures are stored in .rtf .htm and .txt files in the user's profile, and are not accessible from Outlook in a simple fashion.

    More thinking required.... 8-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •