我写了一个按钮-
Private Sub CommandButton1_Click()
Dim path As String
Dim filename1\ As String
path = C:\Users\Barb\Desktop\demo\"
filename1 = Range("C4").Text
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename1=path & filename1 & ".xlsx",
FileFormatxlOpenXMLWorkbook
Application.DisplayAlerts = True
ActiveWorkbook.Close
End Sub
在保存工作表以使用工作表标签的标题时,我怎么知道
答案 0 :(得分:1)
假设您正在谈论ActiveSheet
,请更改:
filename1 = Range("C4").Text
至:
filename1 = ActiveSheet.Name
答案 1 :(得分:1)
例如:
filename1 = sheets(1).name
或
filename1 = activesheet. name