How to use iTunes “currently playing” info as your email signature in Outlook

outlook with itunes screenshot

Ok, here’s one for the masses.

This post describes how to add info about the song currently playing in iTunes to emails you compose in Outlook. Anyone can do it!

First, create the macro. To do so:

  1. Open Outlook.
  2. From the Tools menu, select Macro, then Macros…
  3. In the Macro field, enter a name for your macro. “AddiTunesSig” is probably appropriate. [screenshot]
  4. Click “Create”.
  5. A “code window” will open. This is where, in a minute, you will type the code that makes up the macro.
  6. But first, you need to tell Outlook how to talk to iTunes. To do so, go to the Tools menu and select References. Scroll down until you find “iTunes Type Library” or something similar. Select its checkbox and click OK. [screenshot]
  7. Back in the code window, you will see two lines of code: Sub AddiTunesSig() and End Sub. In between these lines, paste in the following code:
    
    
    ' 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
    
    

    See how easy programming is! [screenshot]

  8. To finish up: Click the Save button on the toolbar and close the code window.

Now, you need to add a toolbar button to your Outlook toolbar that will run this macro. To do so:

  1. Go to the Tools menu, and select Customize…
  2. In the dialog box that pops up, scroll down the left side, and click Macros. [screenshot]
  3. You will see your macro on the right (“Project1.AddiTunesSig”). Drag it up to a convenient location on your toolbar. (Next to the “New” button is probably a good place.)
  4. To rename the button, right-click the button and type the new name where it says “Name:” in the pop-up menu. “New (with music)” is probably a good name. [screenshot]
  5. Close the Customize window.

That’s it! To use it, open iTunes, play a song, go back to Outlook, and click your new button. A new email will open with info about the currently playing song in the signature area.

Leave a Reply

Your email address will not be published. Required fields are marked *