move folders in outlook using vba

Status
Not open for further replies.
P

pete the greek

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
 
S

Sue Mosher [MVP]

> 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

"pete the greek" <petethegreek> wrote in message

news:698A227B-1FBA-4CAD-9627-7E1E77FFA3AB@microsoft.com...
> 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

>
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
Cdub27 Move Outlook 2016 Contacts to Other Folders - Extremely Slow !! Using Outlook 6
O Missing guide "Move an Outlook Personal Folders .pst File" New Slipstick.com Articles 4
Diane Poremsky Move Messages from File System into Outlook Folders New Slipstick.com Articles 0
J Outlook Cannot Move Msgs to Folders (GMAIL IMAP) Using Outlook 1
B OUTLOOK 2013: How Do I Move Emails to Folders stored on my Hard Drive? Using Outlook 3
A How to move responded emaisl automatically to sub folders in Outlook 2007 Using Outlook 0
L Outlook 2010- Be able to move default Mail folders (Outbox, Draft, etc) Outlook Wishlist 1
Z Outlook 2007 move folders from one computer to another Using Outlook 1
D User cannot move email messages within Outlook Inbox folder and sub-folders. Using Outlook 0
S Outlook 2007 'Move To Folders missing from Inbox Using Outlook 5
Z How to move Hotmail folders to Outlook 2007? Using Outlook 6
R List folders in a combo box + select folder + move emails from inbox to that folder + reply to that email Outlook VBA and Custom Forms 1
Commodore Folders always closed in move/copy items dialog box Using Outlook 3
I Automating message move between folders Outlook VBA and Custom Forms 0
D Move Emails between Folders in Separate Mailbox Outlook VBA and Custom Forms 12
Diane Poremsky Create Tasks from Email and move to different Task folders New Slipstick.com Articles 0
J Dopey move - deleted profile Using Outlook 1
GregS Outlook 2016 Move Outlook to new computer? Using Outlook 4
witzker Macro to move @domain.xx of a Spammail to Blacklist in Outlook 2019 Outlook VBA and Custom Forms 7
G Move tasks up/down todo list by VBA Outlook VBA and Custom Forms 1
S Macro to move “Re:” & “FWD:” email recieved the shared inbox to a subfolder in outlook Outlook VBA and Custom Forms 0
S Outlook Macro to move reply mail based on the key word in the subjectline Outlook VBA and Custom Forms 0
D Move Email with Attachment to Folder Outlook VBA and Custom Forms 3
Eike Move mails via macro triggered by the click of a button? Outlook VBA and Custom Forms 0
G Cannot Move Autocomplete File to New Computer Using Outlook 15
M Move to Folder Using Outlook 1
P Move emails between 2 mailboxes. Using Outlook 0
C Copy Move item won't work Outlook VBA and Custom Forms 2
N Macro to move all recipients to CC while replying Outlook VBA and Custom Forms 0
Commodore Move turns into "copy" Using Outlook 3
Jennifer Murphy Ctrl+Tab sometimes will not move through text a word at a time Using Outlook 1
V Outlook 2016 will not move emails in search results Using Outlook 4
M move to iCloud not working in outlook calendar Using Outlook 12
A Create date folder and move messages daily Outlook VBA and Custom Forms 1
C Move Outlook 2007 to new PC with Outlook 365 Using Outlook 3
C Can't move folder, the folder is full Using Outlook 0
Nadine Rule to move attachments with specific name Outlook VBA and Custom Forms 1
A Move email items based on a list of email addresses Outlook VBA and Custom Forms 40
T Move calendar invites to new calendar Using Outlook 5
O Rule to move (specific) messages from Sent folder to Specific folder Using Outlook 1
K Outlook Rules: Move a Copy Using Outlook 4
K VBA BeforeItemMove event create rule to always move to its folder. Outlook VBA and Custom Forms 4
N Move emails of same conversation to same subfolder Using Outlook 6
P when i move inbox mails to another folder in outlook the mail disappears Using Outlook 1
Peter H Williams How to Move Mail item after processing Outlook VBA and Custom Forms 5
E Search for folder by key in subject then move new message to related folder Outlook VBA and Custom Forms 1
I Outlook 2013 Any way to move .OST file to new system? Using Outlook.com accounts in Outlook 5
O On click,I want to change subject line of selected mail and then reply to particular email and move Using Outlook 3
F "Move to" O365 feature to Outlook client via VBA Outlook VBA and Custom Forms 4
B Macro to manually move selected emails to network folder Outlook VBA and Custom Forms 1

Similar threads

Top