View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
macrowriter macrowriter is offline
external usenet poster
 
Posts: 7
Default I need to change this code to copy All files the "customdoc" f

I just tried this and I got a compile error:syntax error in the following line:

oFSO.CopyFolder ""C:\PNTTEMPL\CustomDoc\*",
""C:\PNTTEMPL\CustomDoc\TEST\", True


"Bob Phillips" wrote:

Sub FileCopyExample()
Dim oFSO As Object
Dim sSourcePath As String
Dim sTargetPath As String

Set oFSO = CreateObject("Scripting.FileSystemObject")

oFSO.CopyFolder ""C:\PNTTEMPL\CustomDoc\*",
""C:\PNTTEMPL\CustomDoc\TEST\", True

Set oFSO = Nothing

End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"macrowriter" wrote in message
...
Sub FileCopyExample()
Dim sSourcePath As String
Dim sTargetPath As String

' Change these paths to your Source and Target paths.
sSourcePath = "C:\PNTTEMPL\CustomDoc\CHARM.PCD"
sTargetPath = "C:\PNTTEMPL\CustomDoc\TEST\CHARM.PCD"
On Error Resume Next

' Copy the file "CHARM.PCD" file from "CUSTOMDOC FOLDER"
' to "TEST FOLDER".
FileCopy sSourcePath, sTargetPath

If Err 0 Then MsgBox Err.Description
End Sub