![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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:
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
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 |