How do I identify if it's a meeting request in this outlook macro?

Joined
Jul 9, 2012
Messages
2
Reaction score
0
Hi,

I'm not a developer, was able to use internet to write my first outlook macro *proud*

I have two questions?
1)
Is this macro ok, or did I forget something important?

2)
How can I get a "If, then else" statement here where the macro ONLY reacts on emails and not on meeting requests? I constantly get an error message, if I send (or reply on) any meeting requests. That's pretty annoying.
It all started when I added the row "save email in the inbox". It seams like that outlook can't save meeting requests in any other folder then "sent folder".
That is also what I want:
This macro shouldn't react on meetings...

Thanks
Mike


Code:
Private Sub Application_ItemSend(ByVal Item As Object, _
    Cancel As Boolean)
  Dim objNS As NameSpace
  Dim objFolder As MAPIFolder
  Set objNS = Application.GetNamespace("MAPI")
  Set objFolder = objNS.PickFolder
  If TypeName(objFolder) <> "Nothing" Then
      Set Item.SaveSentMessageFolder = objFolder
    Else: Set Item.SaveSentMessageFolder = objNS.GetDefaultFolder(olFolderInbox)
  End If
  Set objFolder = Nothing
  Set objNS = Nothing
End Sub
 
Joined
Jul 9, 2012
Messages
2
Reaction score
0
Thank you all for the help.. You really helped me!!!!!...
Instead, Google (and 2 hours of testing), solved my problem,....

Perhaps you could have a look and let me know if I do something wrong..

Thanks


Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)

If Item.Class = olMeetingCancellation Or _
Item.Class = olMeetingRequest Or _
Item.Class = olMeetingResponseNegative Or _
Item.Class = olMeetingResponsePositive Or _
Item.Class = olMeetingResponseTentative Then
' MsgBox "MEETING!!!! check-box can be deleted if it works"
Exit Sub
End If

Dim objNS As NameSpace
Dim objFolder As MAPIFolder
Set objNS = Application.GetNamespace("MAPI")
Set objFolder = objNS.PickFolder


If TypeName(objFolder) <> "Nothing" Then
Set Item.SaveSentMessageFolder = objFolder
End If
Set objFolder = Nothing
Set objNS = Nothing
End Sub
 

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