-
May 4th, 2011, 11:24 AM
#1
Copying a file with attributes
I'm using FileCopy in Excel VBA to copy a file from one folder to another. When I do that, the file loses all the attributes I've added on the summary tab. How can I move or copy a file from one folder to another and retain the attributes?
-
May 31st, 2011, 08:54 AM
#2
Re: Copying a file with attributes
Can you post your code segment where you're trying to copy the file? I ran a quick test in both VBScript and VBA and it seems to work fine (I had set the Title and Subject of the source spreadsheet):
Set objFSO=CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "C:\Scripts\Book1.xls","C:\Book1.xls",TRUE
The following VBScript shows the values:
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = False
Set objWorkbook = objExcel.Workbooks.Open("C:\Book1.xls")
On Error Resume Next
For Each strProperty in objWorkbook.BuiltInDocumentProperties
Wscript.Echo strProperty.Name & " – " & strProperty.Value
Next
objExcel.Quit
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|