小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

批量重命名vba

 黃河簡筆畫 2021-12-10

Public Sub PickFolder()

'** 使用FileDialog對象來選擇文件夾

        Dim fd As FileDialog

        Dim strPath As String

        Set fd = Application.FileDialog(msoFileDialogFolderPicker)

        '** 顯示選擇文件夾對話框

        If fd.Show = -1 Then        '** 用戶選擇了文件夾

            strPath = fd.SelectedItems(1)

        Else

            strPath = ""

        End If

        [B1] = strPath

        Set fd = Nothing

End Sub

Sub ReName()

    Dim arr, e

    On Error Resume Next

    For i = 4 To [A65536].End(xlUp).Row

        If Cells(i, 3) <> "" Then

            Name [B1] & "\" & Cells(i, 1) & Cells(i, 2) As [B1] & "\" & Cells(i, 3) & Cells(i, 2)

        End If

    Next

    MsgBox "重命名成功!"

End Sub

 Sub 獲取目錄()

    Dim fs, f, f1, s, sf

    Dim r As Range

    Set fs = CreateObject("Scripting.FileSystemObject")

    Set f = fs.GetFolder([B1])

    Set sf = f.Files

    [A4:A65536] = ""

    For Each f1 In sf

        s = f1.Name

        Set r = [A65536].End(xlUp).Offset(1)

        n = InStrRev(s, ".")

        r = Left(s, n - 1) '文件名

        r.Offset(0, 1) = Mid(s, n)  '后綴

    Next

End Sub

    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多