R
Ray Batig
Sue,
Your code to provide the Lotus Notes like Send and File is working great. I
would like to change the default folder from the Inbox folder to the
Deleted Items folder. In that way, I can click OK to send and not save a
copy, click cancel to send it to the Sent folder, or select the desired
folder and click OK. I have proposed the changes below. Since I am a newbee
to VB in Outlook, I figured it was better to ask before trying.....
Thanks in advance for your help!
Ray
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" And _
IsInDefaultStore(objFolder) Then
Set Item.SaveSentMessageFolder = objFolder
End If
Set objFolder = Nothing
Set objNS = Nothing
End Sub
Public Function IsInDefaultStore(objOL As Object) As Boolean
Dim objApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objDeleted Items As Outlook.MAPIFolder Replaces Dim objInbox As
Outlook.MAPIFolder
On Error Resume Next
Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objDeleted Items = objNS.GetDefaultFolder(olFolderDeleted Items)
Replaces Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
Select Case objOL.Class
Case olFolder
If objOL.StoreID = objInbox.StoreID Then
IsInDefaultStore = True
End If
Case olAppointment, olContact, olDistributionList, _
olJournal, olMail, olNote, olPost, olTask
If objOL.Parent.StoreID = objInbox.StoreID Then
IsInDefaultStore = True
End If
Case Else
MsgBox "This function isn't designed to work " & _
"with " & TypeName(objOL) & _
" items and will return False.", _
, "IsInDefaultStore"
End Select
Set objApp = Nothing
Set objNS = Nothing
Set objDeleted Items = Nothing Replaces Set objInbox = Nothing
End Function
Your code to provide the Lotus Notes like Send and File is working great. I
would like to change the default folder from the Inbox folder to the
Deleted Items folder. In that way, I can click OK to send and not save a
copy, click cancel to send it to the Sent folder, or select the desired
folder and click OK. I have proposed the changes below. Since I am a newbee
to VB in Outlook, I figured it was better to ask before trying.....
Thanks in advance for your help!
Ray
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" And _
IsInDefaultStore(objFolder) Then
Set Item.SaveSentMessageFolder = objFolder
End If
Set objFolder = Nothing
Set objNS = Nothing
End Sub
Public Function IsInDefaultStore(objOL As Object) As Boolean
Dim objApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objDeleted Items As Outlook.MAPIFolder Replaces Dim objInbox As
Outlook.MAPIFolder
On Error Resume Next
Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objDeleted Items = objNS.GetDefaultFolder(olFolderDeleted Items)
Replaces Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
Select Case objOL.Class
Case olFolder
If objOL.StoreID = objInbox.StoreID Then
IsInDefaultStore = True
End If
Case olAppointment, olContact, olDistributionList, _
olJournal, olMail, olNote, olPost, olTask
If objOL.Parent.StoreID = objInbox.StoreID Then
IsInDefaultStore = True
End If
Case Else
MsgBox "This function isn't designed to work " & _
"with " & TypeName(objOL) & _
" items and will return False.", _
, "IsInDefaultStore"
End Select
Set objApp = Nothing
Set objNS = Nothing
Set objDeleted Items = Nothing Replaces Set objInbox = Nothing
End Function