Folder.CopyTo method (Outlook)
Copies the current folder in its entirety to the destination folder.
Syntax
expression. CopyTo
( _DestinationFolder_
)
expression A variable that represents a Folder object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
DestinationFolder | Required | Folder | Required Folder object that represents the destination folder. |
Return value
A Folder object that represents the new copy of the current folder.
Remarks
Setting the REG_MULTI_SZ value, DisableCrossAccountCopy
, in HKCU\Software\Microsoft\Office\14.0\Outlook
in the Windows registry has the side effect of disabling this method.
Example
This Visual Basic for Applications (VBA) example uses the CopyTo method to copy the default Contacts folder to the default Inbox folder.
Sub CopyFolder()
Dim myNameSpace As Outlook.NameSpace
Dim myInboxFolder As Outlook.Folder
Dim myContactsFolder As Outlook.Folder
Dim myNewFolder As Outlook.Folder
Set myNameSpace = Application.GetNamespace("MAPI")
Set myInboxFolder = myNameSpace.GetDefaultFolder(olFolderInbox)
Set myContactsFolder = myNameSpace.GetDefaultFolder(olFolderContacts)
Set myNewFolder = myContactsFolder.CopyTo(myInboxFolder)
End Sub
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.