A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

move folders in outlook using vba



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old December 13th 09, 10:08 PM posted to microsoft.public.outlook.program_vba
pete the greek
external usenet poster
 
Posts: 6
Default move folders in outlook using vba

hi all, im trying to work out how to move folders using vba, i have manged to
move emails to new folders but cant move folders

we use public folders at work and the one i have to drag and drop to is
buried some 10 levels down for the odd move this is no problem but at times i
could be doing 20-30

my problems are

how do you identify the current folder
and then how do you move it

this is what i have so far

myfolder being the one im trying to move
objfolder being the destination

im playing with this on my personal pc hence the required path is not so long

Sub foldermove()
Set objNS = Application.GetNamespace("MAPI")
Set myFolder = objNS.Folders.Item("personal folders").Folders.Item("ongoing
orders for uk").Folders.Item(1)
objfolder = objNS.Folders.Item("personal folders").Folders.Item("inbox")
myFolder.Move (objfolder)






End Sub


Ads
  #2  
Old December 13th 09, 10:39 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP][_4_]
external usenet poster
 
Posts: 552
Default move folders in outlook using vba

how do you identify the current folder

Application.ActiveExplorer.CurrentFolder

and then how do you move it


When in doubt, check the object browser: Press ALt+F11 to open the VBA
environment in Outlook, then press F2. Switch from All Libraries to
Outlook to browse all Outlook objects and their properties, methods, and
events. Select any object or member, then press F1 to see its Help topic. In
your case, a quick glance at the Folder or MAPIFolder object (depending on
your Outlook version, which you should always mention when posting in an
Outlook forum) would reveal a MoveTo method.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"pete the greek" wrote in message
...
hi all, im trying to work out how to move folders using vba, i have manged
to
move emails to new folders but cant move folders

we use public folders at work and the one i have to drag and drop to is
buried some 10 levels down for the odd move this is no problem but at
times i
could be doing 20-30

my problems are

how do you identify the current folder
and then how do you move it

this is what i have so far

myfolder being the one im trying to move
objfolder being the destination

im playing with this on my personal pc hence the required path is not so
long

Sub foldermove()
Set objNS = Application.GetNamespace("MAPI")
Set myFolder = objNS.Folders.Item("personal
folders").Folders.Item("ongoing
orders for uk").Folders.Item(1)
objfolder = objNS.Folders.Item("personal folders").Folders.Item("inbox")
myFolder.Move (objfolder)






End Sub




 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Move item between folders Nigel RS Outlook and VBA 3 November 19th 08 04:32 PM
Outlook Express folders move from workstation to server Howard - JC Publishing Outlook Express 3 March 27th 08 11:31 AM
Outlook Express folders move from workstation to server Howard - JC Publishing Outlook Express 0 March 25th 08 11:50 PM
Move outlook folders & emails from one comptr to another? Rene-Plano TX Outlook - Installation 4 October 10th 06 04:33 PM
MOVE TO FOLDER- How to get more folders showing in Outlook 2003? Mike Outlook - General Queries 2 September 22nd 06 10:41 PM


All times are GMT +1. The time now is 10:15 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.