答:可以。
复制下面代码到VB编辑器里,运行"ModifySheetName"程序。程序会弹出对话框来让你选择文件,修改完成后保存在原位置。
Private Function GetDirectory()
Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogFolderPicker)
With fd
If .Show = -1 Then
GetDirectory = .SelectedItems(1)
Else
GetDirectory = ""
End If
End With
End Function
Sub ModifySheetName()
Dim vFiles As Variant
Dim nIndex As Integer
Dim wkb As Workbook
Dim TotalFiles As Integer
Application.DisplayAlerts = False
vFiles = Application.GetOpenFilename(FileFilter:="Excel工作簿(*.xls*),*.xls*", _
Title:="选择待转换的文件", MultiSelect:=True)
If Not IsArray(vFiles) Then Exit Sub
TotalFiles = UBound(vFiles)
For nIndex = 1 To TotalFiles
Set wkb = GetObject(vFiles(nIndex))
With wkb
Windows(.Name).Visible = True
.Sheets("Sheet1").Name = "Summary"
.Close SaveChanges:=True
End With
Set wkb = Nothing
Next nIndex
Application.DisplayAlerts = True
MsgBox "修改完成!共计" & TotalFiles & "个文件"
End Sub
vba可以。。。。。。。。。。。。。。。。