Application.CopyFile (Outlook)

Copies a file from a specified location into a Microsoft Outlook store.

CopyFile (FilePath, DestFolderPath)


Sub CopyFileSample() 
 
 Dim strPath As String 
 
 Dim ExcelApp As Object 
 
 Dim ExcelSheet As Object 
 
 Dim doc As Object 
 
 
 
 
 
 Set ExcelApp = CreateObject("Excel.Application") 
 
 strPath = ExcelApp.DefaultFilePath & "\MyExcelDoc.xlsx" 
 
 Set ExcelSheet = ExcelApp.Workbooks.Add 
 
 ExcelSheet.ActiveSheet.cells(1, 1).Value = 10 
 
 ExcelSheet.SaveAs strPath 
 
 ExcelApp.Quit 
 
 Set ExcelApp = Nothing 
 
 Set doc = Application.CopyFile(strPath, "Inbox") 
 
End Sub

Arguments

The following arguments are required:

FilePath (String) - The path name of the object you want to copy.

DestFolderPath (String) - The location you want to copy the file to.