Consulting

Results 1 to 2 of 2

Thread: Outlook Macro, Move Selected Message to Inbox

  1. #1
    VBAX Newbie
    Joined
    Jan 2012
    Posts
    3
    Location

    Outlook Macro, Move Selected Message to Inbox

    Hi,

    I am trying to create a macro button that when you press the button it will move the selected message to the inbox.

    I have pasted code below but I am stuck on the "Msg.Move NamSpace.Folders = objNS.GetDefaultFolder(olFolderInbox)" which is the moving the message selected to the inbox.

    If anyone has any better code which does what I want it to then please help me

    Sub MoveItems()

    Dim Messages As Selection
    Dim Msg As MailItem
    Dim NamSpace As NameSpace
    Dim Proceed As VbMsgBoxResult


    Set NamSpace = Application.GetNamespace("MAPI")
    Set Messages = ActiveExplorer.Selection


    If Messages.Count = 0 Then
    Proceed = MsgBox("Please select a message!", vbOKOnly)
    Exit Sub
    End If

    If Messages.Count = 1 Then
    Proceed = MsgBox("Are you sure you want to move message?", vbYesNo)

    If Proceed = vbNo Then
    Exit Sub
    Else
    Msg.Move NamSpace.Folders = objNS.GetDefaultFolder(olFolderInbox)
    End If
    End If
    End Sub

  2. #2
    There shouldn't be an "=" sign in the Msg.Move line. Check out the MS VB Help by selecting the word "Move" and hitting the F1 key for a nice example.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •