在Excel VBA中使用表单另存为位置保存工作表 [英] Save a worksheet with form Save As location in Excel VBA

查看:89
本文介绍了在Excel VBA中使用表单另存为位置保存工作表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我不是开发人员,而是普通的Excel用户,尝试在工作时自动执行某些过程,因此请理解我的问题是否简单易行.

Well, I am not a developer but an regular an Excel user try to automate some process while working so please understand if my question is of simple to do.

我只想要一个宏,当我运行该宏时,它将允许我浏览计算机,以便我可以按自己喜欢的方向和文件名保存文件如果可能的话默认位置是工作簿的位置,只是为了节省时间

I just want to a macro that can when I run the macro, it will allow me to Browse the computer so I can save the file in the direction and file name I like If possible Default location is the location of the workbook, just to save time

谢谢

推荐答案

尝试以下代码:

Sub SaveAsDailog()

Application.DisplayAlerts = False
Dim filePath As Variant
filePath = Application.GetSaveAsFilename("abcd.xlsx", "Excel Files (*.xlsx), *.xlsx")

If VarType(filePath) = vbString Then
 ActiveWorkbook.SaveAs Filename:=filePath
End If


Application.DisplayAlerts = True
End Sub

这篇关于在Excel VBA中使用表单另存为位置保存工作表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆