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 and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

How do I setup a signature select prompt when sending mail



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old September 19th 07, 10:04 AM posted to microsoft.public.outlook.program_vba
Dinesh Perera
external usenet poster
 
Posts: 1
Default How do I setup a signature select prompt when sending mail

Hi,

I need to programm Outlook 2003 in such way that it will prompt the user to
chose a signature from a list of signatures before it send the mail. This
action has to be triggered as soon as the user hit the send button.

Thanks
Ads
  #2  
Old September 19th 07, 06:28 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default How do I setup a signature select prompt when sending mail

You can definitely do this. To hook into the Send event, see this article:

Eric Legault My Eggo : Getting a Handle on Your E-mails with VBA:
http://blogs.officezealot.com/legault/pages/20086.aspx

Getting specific signature text to insert can be achieved with this function
- replace the signature file name with one you know exists:

Function GetSignatureText() As String
Dim objFS As New Scripting.FileSystemObject, objTS As Scripting.TextStream
Dim objF As Scripting.Folder, strSysDrive As String
Dim strUserName As String, strSigText As String

Set objF = objFS.GetSpecialFolder(0)
strSysDrive = Left(objF, 1)
strUserName = FindUserName
Set objTS = objFS.OpenTextFile(strSysDrive & ":\Documents and Settings\"
& strUserName & "\Application Data\Microsoft\Signatures\Work.txt" _
, ForReading, False)
strSigText = objTS.ReadAll
End Function

But ultimately you need to parse out the uniquely named .rtf, .txt and .html
files in that folder to present the user with a list of signatures. Then
take the selection to call a modified function like the one above to return
the actual text. Then append that value to the MailItem.Body property.

--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Dinesh Perera" wrote:

Hi,

I need to programm Outlook 2003 in such way that it will prompt the user to
chose a signature from a list of signatures before it send the mail. This
action has to be triggered as soon as the user hit the send button.

Thanks

  #3  
Old September 20th 07, 09:48 AM posted to microsoft.public.outlook.program_vba
Dinesh Perera[_2_]
external usenet poster
 
Posts: 1
Default How do I setup a signature select prompt when sending mail

Hi Eric,

Thanks a lot for the help. I set the macro according to the article that you
mentioned bellow and now I can trigger functions as I want. I am midway
through setting the multuple signatures and getting a form to display the
list of signatures.

Thanks again for the help.
Regards
Dinesh
Cheers

"Eric Legault [MVP - Outlook]" wrote:

You can definitely do this. To hook into the Send event, see this article:

Eric Legault My Eggo : Getting a Handle on Your E-mails with VBA:
http://blogs.officezealot.com/legault/pages/20086.aspx

Getting specific signature text to insert can be achieved with this function
- replace the signature file name with one you know exists:

Function GetSignatureText() As String
Dim objFS As New Scripting.FileSystemObject, objTS As Scripting.TextStream
Dim objF As Scripting.Folder, strSysDrive As String
Dim strUserName As String, strSigText As String

Set objF = objFS.GetSpecialFolder(0)
strSysDrive = Left(objF, 1)
strUserName = FindUserName
Set objTS = objFS.OpenTextFile(strSysDrive & ":\Documents and Settings\"
& strUserName & "\Application Data\Microsoft\Signatures\Work.txt" _
, ForReading, False)
strSigText = objTS.ReadAll
End Function

But ultimately you need to parse out the uniquely named .rtf, .txt and .html
files in that folder to present the user with a list of signatures. Then
take the selection to call a modified function like the one above to return
the actual text. Then append that value to the MailItem.Body property.

--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Dinesh Perera" wrote:

Hi,

I need to programm Outlook 2003 in such way that it will prompt the user to
chose a signature from a list of signatures before it send the mail. This
action has to be triggered as soon as the user hit the send button.

Thanks

  #4  
Old September 22nd 07, 12:24 PM posted to microsoft.public.outlook.program_vba
Woy
external usenet poster
 
Posts: 5
Default How do I setup a signature select prompt when sending mail

Hi,

I have a similar question: how to add a default signature without prompting?

"Dinesh Perera" wrote:

Hi,

I need to programm Outlook 2003 in such way that it will prompt the user to
chose a signature from a list of signatures before it send the mail. This
action has to be triggered as soon as the user hit the send button.

Thanks

  #5  
Old September 22nd 07, 12:52 PM posted to microsoft.public.outlook.program_vba
Woy
external usenet poster
 
Posts: 5
Default How do I setup a signature select prompt when sending mail

Hi,

I have a similar question: how to add a default signature without prompting?

"Dinesh Perera" wrote:

Hi,

I need to programm Outlook 2003 in such way that it will prompt the user to
chose a signature from a list of signatures before it send the mail. This
action has to be triggered as soon as the user hit the send button.

Thanks

  #6  
Old September 22nd 07, 03:43 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default How do I setup a signature select prompt when sending mail

That sounds like a different question. Please clarify what you're trying to do.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Woy" wrote in message ...
Hi,

I have a similar question: how to add a default signature without prompting?

"Dinesh Perera" wrote:

Hi,

I need to programm Outlook 2003 in such way that it will prompt the user to
chose a signature from a list of signatures before it send the mail. This
action has to be triggered as soon as the user hit the send button.

Thanks

  #7  
Old September 22nd 07, 06:04 PM posted to microsoft.public.outlook.program_vba
Woy
external usenet poster
 
Posts: 5
Default How do I setup a signature select prompt when sending mail

I'm trying to use the signature (if there are more than one) that was set as
default - I mean the one that is normally added to the message.

I believea good way out is to find out which of the signature files is the
newest one and to use it. I wrote the following code (basing on previous
response):

Private Function GetSignatureText() As String
Dim objFSO As New FileSystemObject, objFTO As Scripting.TextStream
Set objFTO = objFSO.OpenTextFile(NewestSignatureFile, ForReading, False,
TristateUseDefault)
GetSignatureText = objFTO.ReadAll
objFTO.Close
End Function
Private Function NewestSignatureFile() As String 'finds the newest file
Dim q As Integer, strTempFileStore As String, intFileMod As Integer,
strAppUsName As String

strAppUsName = Application.UserName

With Application.FileSearch
.LookIn = "C:\Documents and Settings\" & strAppUsName &
"\Application Data\Microsoft\Signatures"
.Filename = "*.txt"
If .Execute 0 Then

If .FoundFiles.Count = 1 Then
NewestSignatureFile = .FoundFiles(1)
Exit Function
End If

If .FoundFiles.Count 1 Then
intFileMod = DateDiff("d", Date, FileDateTime(.FoundFiles(1)))
NewestSignatureFile = .FoundFiles(1)
For q = 1 To .FoundFiles.Count
If intFileMod DateDiff("d", Date,
FileDateTime(.FoundFiles(q))) Then
intFileMod = DateDiff("d", Date,
FileDateTime(.FoundFiles(q)))
NewestSignatureFile = .FoundFiles(q)
End If
Next q
End If
End If
End With

End Function

Is there a better way? A built-in method?

"Sue Mosher [MVP-Outlook]" wrote:

That sounds like a different question. Please clarify what you're trying to do.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Woy" wrote in message ...
Hi,

I have a similar question: how to add a default signature without prompting?

"Dinesh Perera" wrote:

Hi,

I need to programm Outlook 2003 in such way that it will prompt the user to
chose a signature from a list of signatures before it send the mail. This
action has to be triggered as soon as the user hit the send button.

Thanks


  #8  
Old September 24th 07, 01:32 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default How do I setup a signature select prompt when sending mail

There is no built-in method. I've done it by creating and displaying a new message, which will contain the user's default signature.

Remember that signatures exist in three files, for the three different mail formats.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Woy" wrote in message ...
I'm trying to use the signature (if there are more than one) that was set as
default - I mean the one that is normally added to the message.

I believea good way out is to find out which of the signature files is the
newest one and to use it. I wrote the following code (basing on previous
response):

Private Function GetSignatureText() As String
Dim objFSO As New FileSystemObject, objFTO As Scripting.TextStream
Set objFTO = objFSO.OpenTextFile(NewestSignatureFile, ForReading, False,
TristateUseDefault)
GetSignatureText = objFTO.ReadAll
objFTO.Close
End Function
Private Function NewestSignatureFile() As String 'finds the newest file
Dim q As Integer, strTempFileStore As String, intFileMod As Integer,
strAppUsName As String

strAppUsName = Application.UserName

With Application.FileSearch
.LookIn = "C:\Documents and Settings\" & strAppUsName &
"\Application Data\Microsoft\Signatures"
.Filename = "*.txt"
If .Execute 0 Then

If .FoundFiles.Count = 1 Then
NewestSignatureFile = .FoundFiles(1)
Exit Function
End If

If .FoundFiles.Count 1 Then
intFileMod = DateDiff("d", Date, FileDateTime(.FoundFiles(1)))
NewestSignatureFile = .FoundFiles(1)
For q = 1 To .FoundFiles.Count
If intFileMod DateDiff("d", Date,
FileDateTime(.FoundFiles(q))) Then
intFileMod = DateDiff("d", Date,
FileDateTime(.FoundFiles(q)))
NewestSignatureFile = .FoundFiles(q)
End If
Next q
End If
End If
End With

End Function

Is there a better way? A built-in method?

"Sue Mosher [MVP-Outlook]" wrote:

That sounds like a different question. Please clarify what you're trying to do.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Woy" wrote in message ...
Hi,

I have a similar question: how to add a default signature without prompting?

"Dinesh Perera" wrote:

Hi,

I need to programm Outlook 2003 in such way that it will prompt the user to
chose a signature from a list of signatures before it send the mail. This
action has to be triggered as soon as the user hit the send button.

Thanks


  #9  
Old October 10th 12, 06:19 PM
Elizabeth Park Elizabeth Park is offline
Junior Member
 
First recorded activity at Outlookbanter: Oct 2012
Posts: 1
Default

Can you help me with this function?
How can i use this to create macro that will prompt for signature option?
i am very new to macro and this is the first time using this to create some feature in outlook.

i have pasted below function code to the editor but i get compile error: User-defined type not found on first line.

i have went to the link you provided and i even added other defninitions and sub application functions but still giving the compile error.

what am i missing? am i not to use all the functions listed on this link?
http://blogs.officezealot.com/legault/pages/20086.aspx

please help
thank you
Eli


Quote:
Originally Posted by Eric Legault [MVP - Outlook] View Post
You can definitely do this. To hook into the Send event, see this article:

Eric Legault My Eggo : Getting a Handle on Your E-mails with VBA:
http://blogs.officezealot.com/legault/pages/20086.aspx

Getting specific signature text to insert can be achieved with this function
- replace the signature file name with one you know exists:

Function GetSignatureText() As String
Dim objFS As New Scripting.FileSystemObject, objTS As Scripting.TextStream
Dim objF As Scripting.Folder, strSysDrive As String
Dim strUserName As String, strSigText As String

Set objF = objFS.GetSpecialFolder(0)
strSysDrive = Left(objF, 1)
strUserName = FindUserName
Set objTS = objFS.OpenTextFile(strSysDrive & ":\Documents and Settings\"
& strUserName & "\Application Data\Microsoft\Signatures\Work.txt" _
, ForReading, False)
strSigText = objTS.ReadAll
End Function

But ultimately you need to parse out the uniquely named .rtf, .txt and .html
files in that folder to present the user with a list of signatures. Then
take the selection to call a modified function like the one above to return
the actual text. Then append that value to the MailItem.Body property.

--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Dinesh Perera" wrote:

Hi,

I need to programm Outlook 2003 in such way that it will prompt the user to
chose a signature from a list of signatures before it send the mail. This
action has to be triggered as soon as the user hit the send button.

Thanks
 




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
select e-mail account for sending message BBran Outlook - General Queries 12 August 3rd 07 05:42 PM
prompt for signature to use WDavidson Outlook - Installation 4 June 16th 07 03:20 PM
Select a Signature Icon Don Outlook - General Queries 4 January 14th 07 04:30 PM
corporate outlook e-mail signature setup OHM_Diesel Outlook - Installation 0 December 20th 06 10:08 PM
Shortcut to select email signature file daveh551 Outlook - General Queries 2 May 26th 06 08:32 PM


All times are GMT +1. The time now is 04:50 PM.


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.