Outlook 2003 macro signature help please

J

John Kaess

I'm a retired network administrator, my most current exprience being
Exchange 2000 and Outlook 2003. In my prime (20 to 25 years ago) I
could program in assembler, fortran and basic (yes, plain old basic).

Anyway, I'm playing with my outlook signature. I currently have an
external program that inserts (changes) my outlook signature file with
a random quote every 5 minutes. The program home url is:

www.spazmodicfrog.com

Today I found macro code that wil insert my itunes "now playing"
information into the bottom of an outgoing email.

My problem is that when I use this macro to begin a new message, it
starts the message without my signature file (which has my random
quote in it). Is there any way to use this macro code and have it
start a message with my signature file already in it, either before or
after this macro does its thing?

The code is as follows (and it works without any problems):

Sub AddiTunesSig()

' purpose: opens a new mail message,
' appends info re: currently playing track in iTunes

Dim itunes As iTunesApp
Dim strArtist As String
Dim strTitle As String
Dim strOutput As String
Dim mail As Outlook.MailItem

Set itunes = New iTunesApp

'load the track info into easy-to-read variables
strArtist = itunes.CurrentTrack.Artist
strTitle = itunes.CurrentTrack.Name
strAlbum = itunes.CurrentTrack.Album

'assemble the signature
strOutput = vbNewLine & "------------------------------"
strOutput = strOutput & vbNewLine & "Now playing: " & vbCrLf _
& strTitle & vbCrLf & strArtist & vbCrLf & strAlbum

'create a new email message
Set mail = Outlook.CreateItem(olMailItem)

'put the signature in the body
mail.Body = vbNewLine & vbNewLine & strOutput

'show the message to the user
mail.Display

'clear up the memory
Set itunes = Nothing

End Sub
 
S

Sue Mosher [MVP-Outlook]

Display the message first, then append the signature to the message, rather than replacing the body:

mail.Display
mail.Body = mail.Body & vbNewLine & vbNewLine & strOutput
 
J

John Kaess

Thank you, Sue for your quick reply.

I've made the changes as follows, but now clicking on the button on my
toolbar does nothing - no new email appears. I did make a new button,
but still nothing:

Sub AddiTunesSig()

' purpose: opens a new mail message,
' appends info re: currently playing track in iTunes

Dim itunes As iTunesApp
Dim strArtist As String
Dim strTitle As String
Dim strOutput As String
Dim mail As Outlook.MailItem

Set itunes = New iTunesApp

'load the track info into easy-to-read variables
strArtist = itunes.CurrentTrack.Artist
strTitle = itunes.CurrentTrack.Name
strAlbum = itunes.CurrentTrack.Album

'assemble the signature
strOutput = vbNewLine & "------------------------------"
strOutput = strOutput & vbNewLine & "Now playing: " & vbCrLf _
& strTitle & vbCrLf & strArtist & vbCrLf & strAlbum

'create a new email message
Set mail = Outlook.CreateItem(olMailItem)

'show the message to the user
mail.Display

'put the signature in the body
mail.Body = mail.Body & vbNewLine & vbNewLine & strOutput

'clear up the memory
Set itunes = Nothing

End Sub
 
S

Sue Mosher [MVP-Outlook]

What happens when you step through the code in the debugger? Do all statements execute? Are you sure that the message isn't displaying behind some other window?
 
J

John Kaess

Thanks!! When I stepped through it told me macros were not activated,
something screwy in the macro security. Everything is working now.

Thank You for your help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top