Send message with outlook signature
Send message with outlook signature
Send message with outlook signature
Send message with outlook signature
Send message with outlook signature
Send message with outlook signature Send message with outlook signature Send message with outlook signature Send message with outlook signature Send message with outlook signature Send message with outlook signature Send message with outlook signature Send message with outlook signature
Send message with outlook signature Send message with outlook signature
Send message with outlook signature
Go Back  Xtreme Visual Basic Talk > > > Send message with outlook signature


Reply
 
Thread Tools Display Modes
  #1  
Old 03-23-2005, 09:44 AM
staticbob's Avatar
staticbob staticbob is offline
Freshman
 
Join Date: Apr 2004
Location: Manchestershire UK
Posts: 33
Default Send message with outlook signature


Guys,

I have this code to create a new mail message with an attachment. Is it possible to use the signature set-up in the users outlook profile ? We have some fancy HTML signatures set-up and I'm hoping I don't need to re-create the signature in the code.

Cheers
Bob

Code:
Sub SendAttach(ByVal documentpath)
        Dim objOutlk
        Dim objMail
        Dim strMsg
        Const olMailItem = 0
        'Create a new message 
        objOutlk = CreateObject("Outlook.Application")
        objMail = objOutlk.createitem(olMailItem)
        objMail.To = "recipient@whatever.com"
        objMail.cc = ""
        'Set up Subject Line 
        objMail.subject = "Here is the reportr"

        objMail.attachments.add(documentpath)
        objMail.body = strMsg
        objMail.display()
        'Clean up 
        objMail = Nothing
        objOutlk = Nothing
    End Sub
Reply With Quote
  #2  
Old 03-23-2005, 11:46 AM
herilane's Avatar
herilaneSend message with outlook signature herilane is offline
Unashamed geek

Retired Moderator
* Expert *
 
Join Date: Jul 2003
Location: London, England
Posts: 8,988
Default

The signature is inserted automatically. However it looks like that only happens AFTER the message is displayed. So you would need to re-order your code a bit. First, display the message; then get its contents (which will include the signature); then add your text and put the contents back. You'll get some flickering but it shouldn't be too bad, hopefully.
Code:
objMail.Subject = "Here is the reportr" objMail.Display strMsg = objMail.HTMLBody strMsg = Replace$(strMsg, "<BODY>", "<BODY><p>New text</p>") objMail.HTMLBody = strMsg
(VBA code - that's all I have at work, sorry)
Reply With Quote
  #3  
Old 03-23-2005, 03:57 PM
staticbob's Avatar
staticbob staticbob is offline
Freshman
 
Join Date: Apr 2004
Location: Manchestershire UK
Posts: 33
Default

Thanks Helen,

I'll give that a shot over the weekend and report back.

Bob
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Send message with outlook signature
Send message with outlook signature
Send message with outlook signature Send message with outlook signature
Send message with outlook signature
Send message with outlook signature
Send message with outlook signature Send message with outlook signature Send message with outlook signature Send message with outlook signature Send message with outlook signature Send message with outlook signature Send message with outlook signature
Send message with outlook signature
Send message with outlook signature
 
Send message with outlook signature
Send message with outlook signature
 
-->