代码如下,如何让myFiles中的PDF文件由默认排序更改为由pdf创建时间排序?
Private Sub Command1_Click()
Dim a() As String
Dim myPath As String
Dim myFiles As String
Dim f As String
Dim i As Long
Const destFile As String = "施工图纸.pdf"
myPath = "C:\Users\Administrator\Desktop\PDF文件"
If Right(myPath, 1) <> "\" Then myPath = myPath & "\"
ReDim a(1 To 2 ^ 14)
f = Dir(myPath & "*.pdf")
While Len(f)
If StrComp(f, destFile, 1) Then
i = i + 1
a(i) = f
End If
f = Dir()
Wend
If i Then
ReDim Preserve a(1 To i)
myFiles = Join(a, ",")
Call MergePDFs(myPath, myFiles, destFile)
Else
MsgBox "在下面的路径中没有找到PDF文件 " & vbLf & myPath, vbExclamation, "取消"
End If
End Sub