spar-kle
asked on
How can I print the Word Documents in a specified folder in the alpha-numerical order of file names?
I am using the following code to print all of the word documents .docx in a designated folder.
How should I change this code so that it prints in the alpha-numerical order that the files names appear in the folder?
Thanks in advance
How should I change this code so that it prints in the alpha-numerical order that the files names appear in the folder?
Thanks in advance
Private Sub CommandButton21_Click()
Dim sMyDir As String
Dim sDocName As String
' The path to obtain the files.
sMyDir = "\Folder Path"
sDocName = Dir(sMyDir & "*.DOCX")
While sDocName <> ""
' Print the file.
Application.PrintOut FileName:=sMyDir & sDocName
' Get next file name.
sDocName = Dir()
Wend
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thanks
Rob H