This code will do it: copy it, and paste it as a macro into a
spreadsheet. Before you run it you'll need to change the line that
currently says
FilePath = "c:\CSV Files\"
to
FilePath = "c:\Your Exact Directory Tree Here\"
The code finds all the files in that directory with a CSV extension
and renames them without hyphens to an XYZ extension. Then it changes
the XYZ extensions to CSV. If the code changed the non-hyphenated form
to CSV right away the program would loop endlessly.
Sub CSV_No_Hyphen()
Dim OrigName As String
Dim FilePath As String
Dim NewName As String
Dim SheetName
Dim K As Byte
FilePath = "c:\CSV Files\"
OrigName = Dir(FilePath & "*.csv")
Do While OrigName <> ""
For K = 1 To Len(OrigName) - 4
If Mid(OrigName, K, 1) <> "-" Then
NewName = NewName & Mid(OrigName, K, 1)
End If
Next K
FileCopy FilePath & OrigName, FilePath & NewName & ".xyz"
NewName = ""
Kill FilePath & OrigName
OrigName = Dir
Loop
OrigName = Dir(FilePath & "*.xyz")
Do While OrigName <> ""
NewName = Mid(OrigName, 1, Len(OrigName) - 4)
FileCopy FilePath & OrigName, FilePath & NewName & ".csv"
NewName = ""
Kill FilePath & OrigName
OrigName = Dir
Loop
End Sub