Dim dlg As New FolderBrowserDialog
Dim wj As String
If dlg.ShowDialog = DialogResult.Ok Then
Dim Book1 As New XLS.Book
Dim mbwj As String = ProjectPath & "Attachments\测试.xlsx"
Dim Values As New List(Of String) From {ProjectPath & "Attachments\测试1.xlsx", ProjectPath & "Attachments\测试2.xlsx"}
Dim Value As String
For Each Value In Values
wj = value
Dim ss() As String = FileSys.GetName(wj).split(".")
If ss(1) = "xlsx" Then
output.show(wj)
Dim Book2 As New XLS.Book(wj)
For i As Integer = Book2.Sheets.Count - 1 To 0 Step - 1
Dim Sheet = Book2.Sheets(i)
Book2.Sheets.Remove(Sheet)
sheet.name = ss(0) & sheet.name
Book1.Sheets.Add(Sheet)
Next
End If
Next
Book1.Save(mbwj)
End If
此主题相关图片如下:微信图片_20220704203602.png
上述代码把文件名如“测试1、测试2”也取过来了,怎样只取工作表名,不取文件名