lh

Public Class Form1
    Public FileAddress As String
    Public ExcelAddress As String
    Private Sub MoveFile(ByVal N As String, ByVal Suffix As String)


        Dim xlApp As Object
        Dim xlBook As Object
        Dim xlsSheet As Object




        Dim NumberRow As Integer


        Dim Y As String
        Dim Y1 As String
        Dim M As String
        Dim M1 As String
        Dim Excel As String
        Dim File As String
        Dim File1 As String
        Dim File2 As String




        Excel = ExcelAddress
        xlApp = CreateObject("Excel.Application") '创建EXCEL对象
        xlBook = xlApp.Workbooks.Open(Excel) '打开已经存在的EXCEL工件簿文件
        xlsSheet = xlBook.Worksheets(N)  '指定工作表,也可以使用"sheet2"


        M1 = FileAddress & "\" & N  '获取目标地址
        M = M1




        Y1 = FileAddress    '获取原地址
        Y = Y1


        If Dir(M1, vbDirectory) = "" Then
            MkDir(M1)
        End If


        For NumberRow = 2 To 1000 Step 1
            If xlsSheet.cells(NumberRow, 1).value <> "" Then
                File1 = xlsSheet.cells(NumberRow, 1).value
                File2 = xlsSheet.cells(NumberRow, 2).value
                File = xlsSheet.cells(NumberRow, 1).value & "_" & xlsSheet.cells(NumberRow, 2).value


                Y = Y1 & "\" & File & Suffix
                M = M1 & "\" & File & Suffix
                FileCopy(Y, M)
            Else
                Exit For
            End If
        Next


        xlBook.close(True)
        xlApp.quit()
        xlsSheet = Nothing
        xlBook = Nothing
        xlApp = Nothing




    End Sub
    Private Sub CreatExcel(ByVal N As String)
        Dim xlApp As Object
        Dim xlBook As Object
        Dim xlBook1 As Object
        Dim xlsSheet As Object
        Dim xlsSheet1 As Object




        Dim Y As String
        Dim M As String
        Dim M_File As String
        Dim Excel As String
        Dim ExcelName As String


        Excel = ExcelAddress


        Y = Application.StartupPath & "\Data\ORFile.xlsx"


        xlApp = CreateObject("Excel.Application") '创建EXCEL对象
        xlBook = xlApp.Workbooks.Open(Excel) '打开已经存在的EXCEL工件簿文件(第一个EXCEL)
        xlBook1 = xlApp.Workbooks.Open(Y) '打开原始的存在程序根目录下的EXCEL工件簿文件(第二个EXCEL,用于生成要用的EXCEL)
        xlsSheet = xlBook.Worksheets(N)  '指定工作表,也可以使用"sheet2"


        ExcelName = xlBook.name   ''用于得到打开的EXCEL的名称
        M = FileAddress & "\" & N & "\" & N & "-" & ExcelName   '获取目标文件地址
        M_File = FileAddress & "\" & N


        If Dir(M_File, vbDirectory) = "" Then
            MkDir(M_File)
        End If


        FileCopy(Y, M)


        xlBook1 = xlApp.workbooks.open(M)
        xlsSheet1 = xlBook1.worksheets(1)




        xlsSheet.copy(xlsSheet1)
        xlBook1.save()


        xlBook.close(True)
        xlApp.quit()
        xlsSheet = Nothing
        xlBook = Nothing
        xlApp = Nothing


    End Sub




    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles B1.Click


        Dim N As String
        Dim Suffix As String




        ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''机加工件的操作
        If C1.Checked = True Then
            N = "机加工件"
            If C5.Checked = True Then
                Suffix = ".pdf"
                MoveFile(N, Suffix)
            End If


            If C6.Checked = True Then
                Suffix = ".dwg"
                MoveFile(N, Suffix)
            End If


            If C7.Checked = True Then
                Suffix = ".step"
                MoveFile(N, Suffix)
            End If


            CreatExcel(N)
        End If


        '’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘钣金件的操作
        If C2.Checked = True Then
            N = "钣金件"


            If C5.Checked = True Then
                Suffix = ".pdf"
                MoveFile(N, Suffix)
            End If


            If C6.Checked = True Then
                Suffix = ".dwg"
                MoveFile(N, Suffix)
            End If


            If C7.Checked = True Then
                Suffix = ".step"
                MoveFile(N, Suffix)
            End If
            CreatExcel(N)
        End If


        '‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘焊接件的操作
        If C3.Checked = True Then
            N = "焊接件"


            If C5.Checked = True Then
                Suffix = ".pdf"
                MoveFile(N, Suffix)
            End If


            If C6.Checked = True Then
                Suffix = ".dwg"
                MoveFile(N, Suffix)
            End If


            If C7.Checked = True Then
                Suffix = ".step"
                MoveFile(N, Suffix)
            End If
            CreatExcel(N)
        End If




        '‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’订制标准件的操作
        If C4.Checked = True Then
            N = "订制标准件"


            If C5.Checked = True Then
                Suffix = ".pdf"
                MoveFile(N, Suffix)
            End If


            If C6.Checked = True Then
                Suffix = ".dwg"
                MoveFile(N, Suffix)
            End If


            If C7.Checked = True Then
                Suffix = ".step"
                MoveFile(N, Suffix)
            End If
            CreatExcel(N)
        End If
        '’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘相关操作结束
        MsgBox("所有文件已经移动完成", , "提示")


    End Sub


    Private Sub FBD1_HelpRequest(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FBD1.HelpRequest


    End Sub


    Private Sub B2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles B2.Click
        FBD1.ShowDialog()
        FileAddress = FBD1.SelectedPath
        T1.Text = FileAddress


    End Sub


    Private Sub B3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles B3.Click
        OFD1.ShowDialog()
        ExcelAddress = OFD1.FileName
        T2.Text = ExcelAddress


    End Sub
End Class
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
在Linux中,使用ls -lh命令可以以人性化的方式显示文件的大小。其中,参数-l表示以详细列表的形式显示文件信息,参数-h表示将文件的大小以易读的单位(如K、M、G)显示出来。这样做的目的是将每个文件的大小转换为我们熟悉的单位,更容易理解文件的大小信息。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [linux查看文件大小 ---- du -sh * 与 ls -lh](https://blog.csdn.net/yanglangdan/article/details/122850213)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [Linux常用的命令](https://blog.csdn.net/m0_46129001/article/details/126095778)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [每天一个linux终端命令ls命令(3)](https://download.csdn.net/download/weixin_38690402/14063041)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

holyvghost

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值