I'm creating a script to automate the copying of some files, to another location, in case it would be to copy to a location on the network. Below is an example or a minified version of the code, so to speak. The error is as follows: The object does not support the property or method - ObjFso.GetExtensionName
... Line 16, Code: 800A01B6.
Function CopyFile(strSourcePath, strDestinationPath)
Const OverwriteExisting = True
Set objFso = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFso.GetFolder(strSourcePath)
Set extensions = CreateObject("Scripting.Dictionary")
extensions.CompareMode = vbTextCompare
extensions.Add "json", True
extensions.Add "csv", True
extensions.Add "xls", True
extensions.Add "xlsx", True
For Each objFile In objFolder.Files
If extensions.Exists(objFso.GetExtensionsName(objFile.Name)) Then
FSO.CopyFile strSourceFile, strDestinationPath, OverwriteExisting
End If
Next
End Function
CopyFile "C:\Users\Micael Dias\Desktop\F1", "C:\Users\Micael Dias\Desktop\F2"