我正在用vb编写,并使用excels参数将.xls文档转换为pdf。该过程工作正常,因为我使用的是字符串。我需要知道的是以某种方式循环访问源文件夹,然后将该文件夹中的所有文件转换为pdf并放入保留原始文件名的导出文件夹中。 循环是我在编程中存在的祸根,尽管我知道你需要它来为这个行业打下坚实的基础。
例:
Dim excelApplication As ApplicationClass = New ApplicationClass()
Dim excelWorkbook As Workbook = Nothing
Dim paramSourceBookPath As String = "C:My_ProjectsTestingfilename.xls"
Dim paramExportFilePath As String = "C:My_ProjectsTestingfilename.pdf"
提前谢谢。
试试这个:
Dim dir As New IO.DirectoryInfo(path)
Dim files As IO.FileInfo() = dir.GetFiles("*.xls")
For Each file In files
'Do Something
Next