weixin_37641220 2020-10-15 09:33 采纳率: 100%
浏览 212
已采纳

VB6通过Adobe Acrobat合并PDF文件,如何按让PDF按创建时间排序。

代码如下,如何让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
  • 写回答

1条回答 默认 最新

  • threenewbee 2020-10-15 10:24
    关注

    f = Dir(myPath & "*.pdf")
    While Len(f)
    If StrComp(f, destFile, 1) Then
    i = i + 1
    a(i) = f
    End If
    f = Dir()
    Wend
    之后对a数组按照时间先排序下就可以了。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?