【问题标题】:VB looping and ExcelVB循环和Excel
【发布时间】:2012-06-27 16:57:59
【问题描述】:

我正在用vb写作,并使用excels参数将.xls文档转换为pdf。该过程运行良好,因为我使用的是字符串。我需要知道的是以某种方式遍历源文件夹,然后将该文件夹中的所有文件转换为 pdf 并放入保留原始文件名的导出文件夹中。循环是我在编程中存在的严重障碍,尽管我知道你需要它来为这个行业打下坚实的基础。

示例:

    Dim excelApplication As ApplicationClass = New ApplicationClass()
    Dim excelWorkbook As Workbook = Nothing
    Dim paramSourceBookPath As String = "C:\My_Projects\Testing\filename.xls"
    Dim paramExportFilePath As String = "C:\My_Projects\Testing\filename.pdf"

提前致谢。

【问题讨论】:

    标签: visual-studio-2010 excel pdf


    【解决方案1】:

    试试这个:

        Dim dir As New IO.DirectoryInfo(path)
        Dim files As IO.FileInfo() = dir.GetFiles("*.xls")
        For Each file In files
            'Do Something
        Next
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-09-05
      • 2014-07-13
      • 1970-01-01
      • 2023-02-08
      • 2013-06-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多