PC Review


Reply
Thread Tools Rate Thread

How to change signatures using VBA?

 
 
Mueller Michael
Guest
Posts: n/a
 
      30th Jun 2005
Hi.

After buying the book "Microsoft Outlook Programming" some of my problems
were resolved easily, but now i'm stuck with changing signatures using VBA.

Till now I haven't found any solution for changing the signature to a
specific one (out of four) within the Outlook-settings or change the
signature while generating a new Mail, like using a parameter pointing to
the wanted sig.

Can some of you help me out?

Thanks
Michi


 
Reply With Quote
 
 
 
 
Mueller Michael
Guest
Posts: n/a
 
      30th Jun 2005
PS:
Forgot to mention that I use Outlook 2003 (11.6359.6360) SP1.



 
Reply With Quote
 
Michael Bednarek
Guest
Posts: n/a
 
      30th Jun 2005
On Thu, 30 Jun 2005 08:30:07 +0200, "Mueller Michael"
<(E-Mail Removed)> wrote in microsoft.public.outlook.program_vba:

>After buying the book "Microsoft Outlook Programming" some of my problems
>were resolved easily, but now i'm stuck with changing signatures using VBA.
>
>Till now I haven't found any solution for changing the signature to a
>specific one (out of four) within the Outlook-settings or change the
>signature while generating a new Mail, like using a parameter pointing to
>the wanted sig.
>
>Can some of you help me out?


I suggested a solution not so long ago in
<http://groups.google.fi/groups?threadm=uv9JXlCcFHA.3712%40TK2MSFTNGP09.phx.gbl>.

At its shortest, it might look like this:

strBody = strBody & CreateObject("Scripting.FileSystemObject").OpenTextFile(strSigFile, ForReading).ReadAll

It might help to remember that normally signature files are stored in
%USERPROFILE%\Application Data\Microsoft\Signatures

--
Michael Bednarek http://mbednarek.com/ "POST NO BILLS"
 
Reply With Quote
 
Mueller Michael
Guest
Posts: n/a
 
      30th Jun 2005
> >Till now I haven't found any solution for changing the signature to a
> >specific one (out of four) within the Outlook-settings or change the
> >signature while generating a new Mail, like using a parameter pointing to
> >the wanted sig.
> >
> >Can some of you help me out?

>
> I suggested a solution not so long ago in
>

<http://groups.google.fi/groups?threa...2MSFTNGP09.phx.
gbl>.
>
> At its shortest, it might look like this:
>
> strBody = strBody &

CreateObject("Scripting.FileSystemObject").OpenTextFile(strSigFile,
ForReading).ReadAll
>
> It might help to remember that normally signature files are stored in
> %USERPROFILE%\Application Data\Microsoft\Signatures


Hi Michael.

This solution is quite nice, but only for pure textmails. I have to deal
with formated text.
but it's good to see were the signatures are stored, maybe this will be
helpful in the future.

Some clues how to add formated sigantures?

Thanks
Mihci




 
Reply With Quote
 
Sue Mosher [MVP-Outlook]
Guest
Posts: n/a
 
      30th Jun 2005
See http://www.outlookcode.com/codedetail.aspx?id=615 for sample code.

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


"Mueller Michael" <(E-Mail Removed)> wrote in message news:da03hg$ogn$(E-Mail Removed)...
> Hi.
>
> After buying the book "Microsoft Outlook Programming" some of my problems
> were resolved easily, but now i'm stuck with changing signatures using VBA.
>
> Till now I haven't found any solution for changing the signature to a
> specific one (out of four) within the Outlook-settings or change the
> signature while generating a new Mail, like using a parameter pointing to
> the wanted sig.
>
> Can some of you help me out?
>
> Thanks
> Michi
>
>

 
Reply With Quote
 
Mueller Michael
Guest
Posts: n/a
 
      30th Jun 2005
> > Can some of you help me out?
>
> See http://www.outlookcode.com/codedetail.aspx?id=615
> for sample code.


Hi Sue.

Thanks for your reply.
For now I create a new mail, and then I insert the sig. This works quite
well.
Problem is, that the cursor itself stays behind the signature.
But it should stay at first position in the body, like
cursor
empty line
signature

How can I change the cursorposition within the body buy sending a
'STRG+Pos1'?
Do you have a fix for this one, too?

Thanks
Michi



 
Reply With Quote
 
Sue Mosher [MVP-Outlook]
Guest
Posts: n/a
 
      30th Jun 2005
The methods available depend on whether you're using WordMail as the editor, in which case you can set the insertion point with Word methods, or the built-in Outlook editor, in which case you either use a SendKeys kludge or the Redemption SafeInspector.

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


"Mueller Michael" <(E-Mail Removed)> wrote in message news:da0nv5$1tl$(E-Mail Removed)...
>> > Can some of you help me out?

>>
>> See http://www.outlookcode.com/codedetail.aspx?id=615
>> for sample code.

>
> Hi Sue.
>
> Thanks for your reply.
> For now I create a new mail, and then I insert the sig. This works quite
> well.
> Problem is, that the cursor itself stays behind the signature.
> But it should stay at first position in the body, like
> cursor
> empty line
> signature
>
> How can I change the cursorposition within the body buy sending a
> 'STRG+Pos1'?
> Do you have a fix for this one, too?
>
> Thanks
> Michi
>
>
>

 
Reply With Quote
 
Mueller Michael
Guest
Posts: n/a
 
      30th Jun 2005
> How can I change the cursorposition within the body buy sending a
> 'STRG+Pos1'?
> Do you have a fix for this one, too?


Steps should be like:
- insert blank line in body
- jump to the end of the body
- insert signature
- jump to the start of the body

Thanks
Michi



 
Reply With Quote
 
Michael Bednarek
Guest
Posts: n/a
 
      1st Jul 2005
On Thu, 30 Jun 2005 13:12:38 +0200, "Mueller Michael"
<(E-Mail Removed)> wrote in
microsoft.public.outlook.program_vba:

>> >Till now I haven't found any solution for changing the signature to a
>> >specific one (out of four) within the Outlook-settings or change the
>> >signature while generating a new Mail, like using a parameter pointing to
>> >the wanted sig.
>> >
>> >Can some of you help me out?

>>
>> I suggested a solution not so long ago in
>>

><http://groups.google.fi/groups?threadm=uv9JXlCcFHA.3712%40TK2MSFTNGP09.phx.gbl>.
>>
>> At its shortest, it might look like this:
>>
>> strBody = strBody & CreateObject("Scripting.FileSystemObject").OpenTextFile(strSigFile,ForReading).ReadAll
>>
>> It might help to remember that normally signature files are stored in
>> %USERPROFILE%\Application Data\Microsoft\Signatures

>
>Hi Michael.
>
>This solution is quite nice, but only for pure textmails. I have to deal
>with formated text.
>but it's good to see were the signatures are stored, maybe this will be
>helpful in the future.
>
>Some clues how to add formated sigantures?


It works here for HTML-formatted messages as well; I don't see why it
wouldn't work for RTF - you just have to pick the right signature file.

--
Michael Bednarek http://mbednarek.com/ "POST NO BILLS"
 
Reply With Quote
 
John Gregory
Guest
Posts: n/a
 
      2nd Jul 2005
I always run this procedure from an XL module. This procedure will pu
any signature from the OL2K menus for Inbox, Tools, Options, Mai
Format, drop down box in the Body or any signature there can b
hardcoded into the macro to put in the Body. It will put th
signature at the top or bottom or anywhere in the Body. It will als
concatenate parts of the Body from an XL worksheet, hard coded macr
text and the signatures in OL. I do not know if it is forwar
compatible with XL2003, but if not maybe the techniques can b
modified to work. I tested this code dozens of times before postin
it

Sub MailItem_3_With_Signature_From2ndOlMailItemOL2K_JDG(
Dim olApp As Outlook.Applicatio
Dim olSigMailItem As Outlook.MailIte
Dim olMailItem1 As Outlook.MailIte
Set olApp = New Outlook.Applicatio
Set olMailItem1 = olApp.CreateItem(olMailItem
Set olSigMailItem = olApp.CreateItem(olMailItem

If MsgBox(Prompt:="Select default Signature in menus:"
& vbCrLf & vbCrLf &
"Inbox" & vbCrLf &
"Tools" & vbCrLf &
"Options" & vbCrLf &
"Mail Format - Tab" & vbCrLf &
"Use This Signature by Default",
Buttons:=vbOKCancel)
= vbCancel Then GoTo ExitHandle

With olSigMailIte
'Body method will overwrite automatic default signature
'Plain Text never needed in this Signature mail item
'Comment out line below to use default signature
.Body = "" 'Overwrites default Signature, if any
.Display (False) 'Display required, or signature is lost
End Wit

'SIGNATURE FROM OL INBOX TOOLS OPTIONS MAIL FORMA
'ADDED TO BODY OF olSigMailIte
'Comment out to use default signatur
olSigMailItem.GetInspector.CommandBars.
Item("Standard").Controls("&Signature").
Controls("John Gregory").Execute
'Change Signature above to one in your OL Options, Mail Format Tab

With olMailItem
.To = "(E-Mail Removed)
.Subject = "Msg Serial Number 0012
'Body part 1 usually in an XL cell with multiple lines & wor
wrap
'Concatenate new text with a Sig from other olMailItem
.Body = "Concatenate this text and the Body, with a "
& "default signature from the other olMailItem"
& vbCrLf & vbCrLf & olSigMailItem.Bod
'.Body = "Concatenate (1) this text (2) XL cells and" &
" (3) Body with signature in another olMailItem"
& vbCrLf & Range("A1")
& vbCrLf & Range("A2")
& vbCrLf & olSigMailItem.Bod
.Displa
.Sav
End Wit

'PLAIN TEXT method works consistently outside With statement
'Inside a with statement, it fails intermittently! Why
'I ran several dozen tests
olMailItem1.GetInspector.CommandBars.Item("Format").
Controls("Plain Text").Execute 'ID=556

olSigMailItem.Delete 'Delete temporary mail item

ExitHandler
Set olApp = Nothin
Set olSigMailItem = Nothin
Set olMailItem1 = Nothin
End Su

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
automatically change signatures when using different accounts =?Utf-8?B?S2F0aHJ5bg==?= Microsoft Outlook Discussion 3 4th Nov 2007 08:48 PM
Signatures Grayed out-Cannot add or change signatures thamdy@quixnet.net Microsoft Outlook Discussion 1 11th Jun 2006 05:22 AM
How can I change the external editor used with signatures? =?Utf-8?B?Um9uYWxkIHZhbiBkZW4gTWFhZ2RlbmJlcmc=?= Microsoft Outlook Installation 1 23rd Feb 2006 08:30 PM
How to change signatures - Outlook 2003 Orrie Microsoft Outlook Discussion 2 12th Apr 2005 12:00 AM
Change the Signatures folder location? CJSnet Microsoft Outlook Installation 3 18th Oct 2004 01:48 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:59 AM.