raviroyalnew
New Member
- Joined
- Apr 23, 2018
- Messages
- 4
Hello,
Please suggest, where I am wrong.
Please suggest, where I am wrong.
Code:
Sub folder()
Dim sFolderName As String, set_Path As String, name As String, datpath As String
Dim FromPath As String
Dim FSO As Object
Set fs = CreateObject("Scripting.FileSystemObject")
FromPath = "C:\Users\sharr12\Desktop\Suivi\2132_sheet_suivi.xlsx" '<< Change
set_Path = "C:\Users\sharr12\Desktop\Suivi\Fact Bakup\Suivi Fact_Backup_"
sFolderName = Format(Now(), "mm-dd-yy")
[name] = (set_Path & sFolderName)
datpath = [name]
If Error <> 0 Then
'MsgBox " Folder exists", vbInformation, "EOD Report Filter" 'Resume Next if folder exists
End If
On Error Resume Next
fs.CreateFolder [name]
'FileCopy "C:\Users\sharr12\Desktop\Suivi\2132_sheet_suivi.xlsx" & [name]
'FSO.CopyFile Source:=FromPath & FileExt, Destination:=[name]
Dim SourceFile, DestinationFile
Dim sourcepath
Dim destinationpath
SourceFile = "C:\Users\sharr12\Desktop\Suivi\2132_sheet_suivi.xlsx"
destinationpath = datpath
SourceFile = "2132_sheet_suivi.xlsx" ' Define source file name.
DestinationFile = "2132_sheet_suivi.xlsx" ' Define target file name.
FileCopy SourceFile, datpath ' Copy source to target.
End Sub
Last edited by a moderator: