|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
本帖最后由 ykcbf1100 于 2024-8-11 18:43 编辑
工作簿另存- Sub ykcbf() '//2024.8.11
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- fn = Application.InputBox("请输入另存工作簿名称:", "新工作簿名", "新工作簿")
- rq = Application.InputBox("请输入另存文件名用的日期:", "自定义日期格式", "20240811")
- With Application.FileDialog(msoFileDialogFolderPicker)
- .Title = "请选择另存工作簿文件夹"
- .InitialFileName = ThisWorkbook.Path & ""
- If .Show = -1 Then
- p = .SelectedItems(1) & ""
- End If
- End With
- Set ws = ThisWorkbook
- ws.Sheets(Array("供应", "生产", "销售")).Copy
- Set wb = ActiveWorkbook
- wb.SaveAs Filename:=p & fn & rq & ".xls", FileFormat:=56
- wb.Close
- Application.ScreenUpdating = False
- MsgBox "OK!"
- End Sub
复制代码
|
|