A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Auto add outlook default signature



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 14th 06, 03:37 PM posted to microsoft.public.outlook.program_forms
Kevin
external usenet poster
 
Posts: 85
Default Auto add outlook default signature

I have tried a few things but just can not seem to find the command that
would auto insert the outlook default signature when I create a new email
message using a vbs......i have tried options that read the default .htm
signature file but this never gives the same result with referenced images
not been seen by the receiver. How does outlook do it. It is like outlook
somehow embeds the signature so there are no referencing issues...any help
would be great......if you need to look at my current code I can post that.
Ads
  #2  
Old November 14th 06, 04:00 PM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Auto add outlook default signature

The code sample at http://www.outlookcode.com/codedetail.aspx?id=615 is for Outlook VBA, but could be adapted to VBScript. If you have embedded images in the signature, though,you also would need to apply the technique described at http://www.outlookcode.com/d/code/htmlimg.htm

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Kevin" wrote in message ...
I have tried a few things but just can not seem to find the command that
would auto insert the outlook default signature when I create a new email
message using a vbs......i have tried options that read the default ..htm
signature file but this never gives the same result with referenced images
not been seen by the receiver. How does outlook do it. It is like outlook
somehow embeds the signature so there are no referencing issues...any help
would be great......if you need to look at my current code I can post that.

  #3  
Old November 14th 06, 05:20 PM posted to microsoft.public.outlook.program_forms
Kevin
external usenet poster
 
Posts: 85
Default Auto add outlook default signature

Thankyou for your response......unfortunately i do not know how to convert
the vba code to vbs.........anyway after looking at the vba code I want to
ask that if I do get what is written in vba code and amend my vbs code to
match.......will my result show images in a signature that are no longer
referenced. Could you have a look at my code and let me know if i am on the
right track and if it would be easy to amend to incorporate the cdo technique

Dim OutApp
Dim OutMail
Dim strbody
Dim SigString
Dim Signature

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
Set fso = CreateObject("Scripting.FileSystemObject")
Set theFile=fso.CreateTextFile ("C:\Program Files\HRS\vbs\Email.htm", vbTrue)
theFile.WriteLine "HTML"
theFile.WriteLine "BODY"
theFile.WriteLine "Hello BobBR"
theFile.WriteLine "BR"
theFile.WriteLine "How are youBR"
theFile.WriteLine "BR"
theFile.WriteLine "RegardsBR"
theFile.WriteLine "/BODY"
theFile.WriteLine "/HTML"
theFile.Close
Set f = fso.OpenTextFile("C:\Program Files\HRS\vbs\Email.htm",1)

MyHTML = f.ReadAll
f.Close

sfile = "C:\Documents and Settings\Sublime\Application
Data\Microsoft\Signatures\MydefaultSignature.htm"
Set ts = fso.GetFile(sFile).OpenAsTextStream(1, -2)
signature=ts.readall
ts.Close

On Error Resume Next
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = "test"
.HTMLBody = MyHTML & "brbr" & Signature
.Display
End With

On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
  #4  
Old November 14th 06, 05:49 PM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Auto add outlook default signature

Sorry, but I don't know what you mean by " images in a signature that are no longer referenced."

There's no reason to write a text file just for the purpose of loading its content into HTMLBody. You can simply build a string variable with the same HTML content.

You also need to take a look at what this expression -- MyHTML & "brbr" & Signature -- returns. If you do, you'll see that it is not well-formed HTML content. You'll have internal /html and html tags, etc.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Kevin" wrote in message ...
Thankyou for your response......unfortunately i do not know how to convert
the vba code to vbs.........anyway after looking at the vba code I want to
ask that if I do get what is written in vba code and amend my vbs code to
match.......will my result show images in a signature that are no longer
referenced. Could you have a look at my code and let me know if i am on the
right track and if it would be easy to amend to incorporate the cdo technique

Dim OutApp
Dim OutMail
Dim strbody
Dim SigString
Dim Signature

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
Set fso = CreateObject("Scripting.FileSystemObject")
Set theFile=fso.CreateTextFile ("C:\Program Files\HRS\vbs\Email.htm", vbTrue)
theFile.WriteLine "HTML"
theFile.WriteLine "BODY"
theFile.WriteLine "Hello BobBR"
theFile.WriteLine "BR"
theFile.WriteLine "How are youBR"
theFile.WriteLine "BR"
theFile.WriteLine "RegardsBR"
theFile.WriteLine "/BODY"
theFile.WriteLine "/HTML"
theFile.Close
Set f = fso.OpenTextFile("C:\Program Files\HRS\vbs\Email.htm",1)

MyHTML = f.ReadAll
f.Close

sfile = "C:\Documents and Settings\Sublime\Application
Data\Microsoft\Signatures\MydefaultSignature.htm"
Set ts = fso.GetFile(sFile).OpenAsTextStream(1, -2)
signature=ts.readall
ts.Close

On Error Resume Next
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = "test"
.HTMLBody = MyHTML & "brbr" & Signature
.Display
End With

On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing

  #5  
Old November 14th 06, 05:51 PM posted to microsoft.public.outlook.program_forms
Kevin
external usenet poster
 
Posts: 85
Default Auto add outlook default signature

Ok I had a look at the vba code and tried a test. I got it to look at a jpeg
file in my signatures folder but it did not show the image in the resulting
displayed email. Does my converted vbs code look ok....i did my best to try
and convert it to vbs

Dim objApp
Dim l_Msg
Dim colAttach
Dim l_Attach
Dim oSession
Dim oMsg
Dim oAttachs
Dim oAttach
Dim colFields
Dim oField
Dim strEntryID
Set objApp = CreateObject("Outlook.Application")
Set l_Msg = objApp.CreateItem(olMailItem)
Set colAttach = l_Msg.Attachments
Set l_Attach = colAttach.Add("C:\Documents and
Settings\Sublime\Application Data\Microsoft\Signatures\Co
Logo_files\image001.jpg")
l_Msg.Close olSave

strEntryID = l_Msg.EntryID
Set l_Msg = Nothing
Set colAttach = Nothing
Set l_Attach = Nothing
On Error Resume Next
Set oSession = CreateObject("MAPI.Session")
oSession.Logon "", "", False, False
Set oMsg = oSession.GetMessage(strEntryID)

Set oAttachs = oMsg.Attachments
Set oAttach = oAttachs.Item(1)
Set colFields = oAttach.Fields
Set oField = colFields.Add(CdoPR_ATTACH_MIME_TAG, "image/jpeg")
Set oField = colFields.Add(&H3712001E, "myident")
oMsg.Fields.Add "{0820060000000000C000000000000046}0x8514", 11, True
oMsg.Update

Set l_Msg = objApp.GetNamespace("MAPI").GetItemFromID(strEntry ID)

l_Msg.HTMLBody = "IMG align=baseline border=0 hspace=0 src=cid:myident"
l_Msg.Close (olSave)
l_Msg.Display

Set oField = Nothing
Set colFields = Nothing
Set oMsg = Nothing
oSession.Logoff
Set oSession = Nothing
Set objApp = Nothing
Set l_Msg = Nothing

  #6  
Old November 25th 06, 03:18 AM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Auto add outlook default signature

Well, this statement is a bit spa

l_Msg.HTMLBody = "IMG align=baseline border=0 hspace=0 src=cid:myident"

You'd really want to provide the full HTML, including the htmlbody and corresponding end tags and any text you want in the signature.

You might also need to set the CDO Message (oMsg) to Nothing before you try to display it.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Kevin" wrote in message ...
Ok I had a look at the vba code and tried a test. I got it to look at a jpeg
file in my signatures folder but it did not show the image in the resulting
displayed email. Does my converted vbs code look ok....i did my best to try
and convert it to vbs

Dim objApp
Dim l_Msg
Dim colAttach
Dim l_Attach
Dim oSession
Dim oMsg
Dim oAttachs
Dim oAttach
Dim colFields
Dim oField
Dim strEntryID
Set objApp = CreateObject("Outlook.Application")
Set l_Msg = objApp.CreateItem(olMailItem)
Set colAttach = l_Msg.Attachments
Set l_Attach = colAttach.Add("C:\Documents and
Settings\Sublime\Application Data\Microsoft\Signatures\Co
Logo_files\image001.jpg")
l_Msg.Close olSave

strEntryID = l_Msg.EntryID
Set l_Msg = Nothing
Set colAttach = Nothing
Set l_Attach = Nothing
On Error Resume Next
Set oSession = CreateObject("MAPI.Session")
oSession.Logon "", "", False, False
Set oMsg = oSession.GetMessage(strEntryID)

Set oAttachs = oMsg.Attachments
Set oAttach = oAttachs.Item(1)
Set colFields = oAttach.Fields
Set oField = colFields.Add(CdoPR_ATTACH_MIME_TAG, "image/jpeg")
Set oField = colFields.Add(&H3712001E, "myident")
oMsg.Fields.Add "{0820060000000000C000000000000046}0x8514", 11, True
oMsg.Update

Set l_Msg = objApp.GetNamespace("MAPI").GetItemFromID(strEntry ID)

l_Msg.HTMLBody = "IMG align=baseline border=0 hspace=0 src=cid:myident"
l_Msg.Close (olSave)
l_Msg.Display

Set oField = Nothing
Set colFields = Nothing
Set oMsg = Nothing
oSession.Logoff
Set oSession = Nothing
Set objApp = Nothing
Set l_Msg = Nothing

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to stop outlook from removing auto signature danny Outlook - General Queries 0 October 17th 06 10:02 PM
How to stop outlook from removing auto signature danny Outlook and VBA 0 October 17th 06 10:00 PM
Not able to add default Signature antonio Outlook and VBA 5 May 12th 06 06:32 AM
Can I add a default Subject to my signature file? Aaron_I Outlook - Using Forms 0 February 23rd 06 12:11 AM
Can I add a default Subject to my signature file? Aaron_I Outlook - Installation 0 February 22nd 06 07:36 PM


All times are GMT +1. The time now is 02:10 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.