I have files without an extension type. I manually open them with Word before running a macro on them.
I created a second macro which opens all files within a folder then runs the other macro - which I can get working if the files have an extension.
Is there a way to get the second macro to open files without an extension as a Word doc? Or would there be another way of doing this?
Option 1: Fix the problem at the source. Wherever you're getting these files from, fix that so that the files will have an extension.
Option 2: Assign an extension:
Sub assign_extension()
Dim f
Dim FSO As Object
Const ext as String = ".txt" '### MODIFY AS NEEDED
Const path As String = "C:\Path\To Your Files\" '### MODIFY AS NEEDED
Set FSO = CreateObject("Scripting.FileSystemObject")
f = Dir(path)
Do
Debug.Print f
If FSO.GetExtensionName(path & f) = vbNullString Then
Name (path & f) As (path & f & ext)
End If
f = Dir()
Loop While f <> vbNullString
End Sub