EXCEL VBA中怎么用控件来实现保存功能,即创建一个保存命令按钮,然后以***+日期作为文件名
展开全部
这个很简单。
Sub SaveAs()
s = VBA.Split(ThisWorkbook.Name, ".")(0)
ThisWorkbook.SaveAs Filename:=ThisWorkbook.Path & "\" & s & Format(Date, "yyyy-mm-dd") & ".xlsm"
End Sub
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Sub AX_SP_ReportOutput()
Dim N As Integer, MinMax_File As String
Application.ScreenUpdating = False
On Error Resume Next
N = MsgBox("叫旧AX Shipipping plan盾? ", 1 + vbQuestion + vbDefaultButton1, "放纳矗ボ")
If N = 1 Then
If ActiveSheet.FilterMode = True Then ActiveSheet.ShowAllData
Sheet11.Select
Sheet11.Copy
Cells.Select
Selection.Copy
Selection.Paste
Cells(1, 1).Select
Application.CutCopyMode = False
ChDir "C:\Documents and Settings\" & Application.UserName & "\"
MinMax_File = Application.GetSaveAsFilename(CurDir & "\" & "LV(BJ) " & Cells(6, "a") & " shipping plan AX " & Application.WorksheetFunction.Text(Date, "MM-DD-YYYY") & ".xls", "Excel Files(*.xls),*.xls", , "Name your file")
If MinMax_File = "False" Then
MsgBox "癸ぃ癣眤ゼゅン", vbExclamation, "Navy矗ボ"
Exit Sub
Else
ActiveWorkbook.SaveAs MinMax_File, xlNormal
Windows(Dir(MinMax_File)).Close
End If
Else
Exit Sub
End If
End Sub
用这个自己改改吧
Dim N As Integer, MinMax_File As String
Application.ScreenUpdating = False
On Error Resume Next
N = MsgBox("叫旧AX Shipipping plan盾? ", 1 + vbQuestion + vbDefaultButton1, "放纳矗ボ")
If N = 1 Then
If ActiveSheet.FilterMode = True Then ActiveSheet.ShowAllData
Sheet11.Select
Sheet11.Copy
Cells.Select
Selection.Copy
Selection.Paste
Cells(1, 1).Select
Application.CutCopyMode = False
ChDir "C:\Documents and Settings\" & Application.UserName & "\"
MinMax_File = Application.GetSaveAsFilename(CurDir & "\" & "LV(BJ) " & Cells(6, "a") & " shipping plan AX " & Application.WorksheetFunction.Text(Date, "MM-DD-YYYY") & ".xls", "Excel Files(*.xls),*.xls", , "Name your file")
If MinMax_File = "False" Then
MsgBox "癸ぃ癣眤ゼゅン", vbExclamation, "Navy矗ボ"
Exit Sub
Else
ActiveWorkbook.SaveAs MinMax_File, xlNormal
Windows(Dir(MinMax_File)).Close
End If
Else
Exit Sub
End If
End Sub
用这个自己改改吧
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
保存按钮的代码,
thisworkbook.saveas <文件名>
thisworkbook.saveas <文件名>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询