-
Dear Killian - I cant believe that it was as easy as that!!!
Thank you so much you are a legend 
I have many more questions regarding my code and making it more efficient but for all intensive purposes I now have something that works. I assume that it would be best to raise new post specific to any further issues I have rather than post here so have marked this as solved
Again thanks for taking the time to read my post and reply it is greatly appreciated.
I have re-posted the final code in case it helps anyone else (some changes)
[VBA]
'Thanks to the following for providing most of the source code
'Sue Mosher &
'Eric Legualt - http://blogs.officezealot.com/legaul...cles/2224.aspx
'Samuel Wright - http://www.vbaexpress.com/forum/show...editor+outlook
'Killian http://www.vbaexpress.com/forum/show...post64451(post includes further background)
'Note: In order for this code to work the person names smart tags must be enabled (Options/Other)
Sub objMailItem_Open(Cancel As Boolean)
Dim objRecipient As Recipient
Dim objSubject As String
On Error Resume Next
'Select only mails where To and Subject are blank - this should only be New Mails
If objMailItem.To = "" And objMailItem.subject = "" Then
GoTo newMail
Else: Exit Sub
End If
newMail:
With objMailItem
'Minimises the WordMail window so the input box can be seen if Word is the mail editor
'NOTE: If On Error Resume Next is not referenced this does not work.
'Provided by Samuel Wright
If ActiveInspector.IsWordMail = True Then
Application.ActiveInspector.WindowState = olMinimized
End If
'Input messagebox for Client Name or Project Number
strEmail = InputBox("Please Input Appropriate Job Number or Client Name", "Job Number")
'If user does not want to send mail to project mailbox
If strEmail = "" Then
GoTo killSub
'Set mailbox Address and email Subject line
Else: objMailItem.CC = strEmail
'Resolve the address to find the correct Project email address eg 9999@sipgroup.com
objMailItem.Recipients.ResolveAll
End If
'Input box for Subject Line
objSubject = InputBox("Please Include a Descriptive Subject", "Subject")
objMailItem.subject = strEmail + " " + "-" + " " + objSubject
'Display email if Word is mail editor
'Provided by Killian
If ActiveInspector.IsWordMail = True Then
objMailItem.Display
End If
If objSubject = "" Then
GoTo killSub
End If
End With
killSub:
If ActiveInspector.IsWordMail = True Then
objMailItem.Display
End If
End Sub
[/VBA]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules