View Single Post
 
Old 09-16-2010, 12:40 AM
Joostdegrote Joostdegrote is offline Windows 7 Office 2007
Advanced Beginner
 
Join Date: Sep 2010
Location: The Netherlands
Posts: 45
Joostdegrote is on a distinguished road
Default

OK.. So it kinda seems to be fixed..

(SOURCE: http://www.outlookcode.com/d/code/setsavefolder.htm )
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" 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 objInbox As Outlook.MAPIFolder
  On Error Resume Next
  Set objApp = CreateObject("Outlook.Application")
  Set objNS = objApp.GetNamespace("MAPI")
  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 objInbox = Nothing
End Function
When putting this to Extra>>Makro's>> Visual Basic Editor (there go to Project1> Microsoft office outlook>ThisOutlookSession)
I get a pop-up window saying where to save the sent item. If i don't specify the folder, it won't be saved at all!

Somehow, i still have a problem.. now that i rebooted Outlook, I don't get no pop-up no more... While the script still is in there! So somehow..... It's screwed up anyway .... anyone here has an idea how/why?
Reply With Quote