Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook Button: move message to a specific folder 1

Status
Not open for further replies.

oquinnc

Technical User
Feb 27, 2001
38
US
I am attempting to create a button in Outlook that will move the current message to a specific folder (predestined). I had planned to set up a macro to do this, but it looks you can't record macros with Outlook.

You can, however, use VBA. My knowledge of VBA is VERY limited. Is there a good resource that will tell me how to do this, or perhaps someonw has a code snippet that already does it.

THANKS!
 
The code below illustrates the basics. It assumes:
1) there is just one item selected
2) the folder you want to move to is a subfolder of inbox
3) the folder name is "&&ejournals"
Put the sub into an Outlook VBA module, and create a button (right-click in the toolbar area, choose "Customize", then choose "Macros" from the commands tab and drag your macro over to a toolbar).
Good luck

Sub MoveOverThere()
Dim mi As MailItem
Dim fld As MAPIFolder
Set mi = ActiveExplorer.Selection.Item(1)
Set fld = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)
Set fld = fld.Folders("&&ejournals")
mi.Move fld
End Sub
Rob
[flowerface]
 
It looks like it is going to work, but when I drag the macro up to the tool bar, there is a small "X" that appears next to the mouse as soon as I drag it anywhere...do I need to publish it or something else to make it available as a button?
 
The button needs to be on a toolbar. You can make a new one, or you can put the button on an existing toolbar. While you're dragging the item, the mouse cursor will have the X until you're at a valid location - that is, hovering over a toolbar on your screen. To try it out, just put it on your main toolbar - you can worry about putting it on a custom toolbar later.
Rob
[flowerface]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top