View Single Post
  #1  
Old April 26th 06, 04:08 PM posted to microsoft.public.outlook.program_vba
kaiser
external usenet poster
 
Posts: 8
Default Help with prompting for a subject

Hi

Can anyone please help me. I am trying to write a macro that does the
following.


When an email is opened (either a new email or a reply / forward) the
macro must check if there is content inthe subject line. If there is,
then it must do nothing but open the email ready for forward or reply,
however, if there is NO subject it must bring up a msgbox saying "No
Subject"


Can anyone help me with this? SOmeone the forum previously helped me
with the following code (which when opening an email, prompted you to
chose from one of five choices from a userform and would enter a
preassigned string inot the subject). Perhaps this code will help


Thnks!


under modules:


Private Sub Application_Startup()
Set m_colInspectors = Application.Inspectors
End Sub


under ThisOutlookSession:
Option Explicit
Private WithEvents m_colInspectors As Outlook.Inspectors
Private WithEvents CurrentInspector As Outlook.Inspector


Private Sub Application_Startup()
Set m_colInspectors = Application.Inspectors
End Sub


Private Sub CurrentInspector_Activate()
Dim oMail As Outlook.MailItem
If Len(UserForm1.SelectedSubject) Then
Set oMail = CurrentInspector.CurrentItem
oMail.Subject = UserForm1.SelectedSubject
End If
Set CurrentInspector = Nothing
End Sub


Private Sub m_colInspectors_NewInspector(ByVal Inspector As
Outlook.Inspector)
If TypeOf Inspector.CurrentItem Is Outlook.MailItem Then
If Inspector.CurrentItem.EntryID = vbNullString Then
UserForm1.SelectedSubject = vbNullString
UserForm1.Show
Set CurrentInspector = Inspector
End If
End If
End Sub


and obbiously had the userform

Ads