.
Not certain why your macro is not functioning as desired. Sorry.
The following works here :
Option Explicit
'''
'strPathSource: The full path of the file to copy
'strPathOutput: The full to copy the file to
Private Sub Copy_File(ByVal strPathSource _
As String, ByVal strPathOutput As String)
Dim objFSO As Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
'copy file
Call objFSO.CopyFile(strPathSource, strPathOutput)
End Sub
Sub Example1()
On Error GoTo err:
Call Copy_File(Environ("userprofile") & "\Documents\*.xls*", _
Environ("userprofile") & "\Documents\vbscripting")
Exit Sub
err: MsgBox "No Excel files.", vbInformation, "Error"
End Sub
NOTE: This macro does not auto-create the folder "vbscripting" if it does not already exist. You can borrow theportion of code from your macro to accomplish same.