Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I need the subject line in my Outlook messages to begin with job the message concerns. Since there are about a dozen jobs going on at any particular time, it's cumbersome to either type the job name in, or copy and paste from another message. I've been working with a macro with a button on the Outlook menu that creates a new message, but right now I'm stuck with one job as the subject, and haven't figured out how to give myself a drop down menu of all the possible job names. So, any assistance would be greatly appreciated.

share|improve this question
    
Here's the macro that I'm currently using. I could create an individual macro for each of the jobs, but that takes up a lot of screen space. And it would be easier to update the jobs as needed using the drop down menu. Sub AutoSubject() Set myFolder = Session.GetDefaultFolder(olFolderInbox) Set myItem = myFolder.Items.Add("IPM.Note.mail") myItem.Display With myItem .Subject = "1209 NL Utilities" .Display End With End Sub –  Dave Hutchinson Aug 5 '12 at 7:26
    
I believe that's not possible. It's also impossible to have an auto-complete feature for the subject line in Outlook. –  amiregelz Aug 5 '12 at 12:57
    
The html form tag... but then you wouldn't really need Outlook at all. –  technosaurus Aug 5 '12 at 14:40
add comment

1 Answer

Try something like this. Be sure to have an open item when you launch.

http://www.vbaexpress.com/kb/getarticle.php?kb_id=369

http://www.vbaexpress.com/kb/getarticle.php?kb_id=303

'** The following code goes in a userform **

' Adapted for a single choice

Private Sub cmdOkay_Click()
Dim i As Long
Dim msg As String
Dim Check As String

Dim currItem As MailItem

'Generate a list of the selected items
With ListBox1
    For i = 0 To .ListCount - 1
        If .Selected(i) Then
            msg = .List(i)
            Exit For
        End If
    Next i
End With

If msg = vbNullString Then
    'If nothing was selected, tell user and let them try again
    MsgBox "Nothing was selected!  Please make a selection!"
    Exit Sub

Else

    Set currItem = Application.ActiveInspector.currentItem
    currItem.Subject = msg
    Unload Me

End If

End Sub

Private Sub cmdCancel_Click()
Unload Me
End Sub

Private Sub UserForm_Initialize()

With Me.ListBox1
     'Clear the rowsource in case it has been set
    .RowSource = ""
     'Add the items
    .AddItem ("Cat")
    .AddItem ("Dog")
    .AddItem ("Gerbil")
    .AddItem ("Lizard")
    .AddItem ("Rat")
    .AddItem ("Snake")
    .AddItem ("Turtle")
End With

End Sub


 '** The following code goes in a standard module **

Sub Launch()
'This code will launch the userform
    UserForm1.Show
End Sub
share|improve this answer
    
Thank you Niton for your reply! I will check that out. –  Dave Hutchinson Aug 7 '12 at 18:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.