Syntax
CopyFile .FileName = text, .Directory = text
Remarks
Copies a file to the specified folder. CopyFile allows you to specify a new name when copying the file.
Argument | Explanation | |
.FileName | The name of the file to copy. If you do not specify the path, Word copies the file from the current folder. | |
.Directory | The path of the folder to which the file is copied. Include a filename if you want to rename the file in addition to copying it. |
Examples
This example copies the document JULY.DOC to the C:\WINWORD\ MEMOS folder. On the Macintosh, substitute a folder name such as HD:WORD 6:MEMOS.
CopyFile "JULY.DOC", "C:\WINWORD\MEMOS"
This example displays a dialog box that prompts for the folder to which to copy the active document. The proposed folder is C:\BAK. On the Macintosh, substitute a default folder name such as HD:BACKUP.
a$ = FileName$() Dim dlg As CopyFile dlg.FileName = a$ dlg.Directory = "C:\BAK" x = Dialog(dlg) If x = -1 Then CopyFile dlg
See Also
FileSaveAs, Kill, Name