如何在VBA中打入对话框?

我有一个Excelmacros创build一个.txt文件,打开另存为对话框,并填写文件名称。 但是,我不知道如何击中另存为对话框上的inputbutton。

我已经尝试使用SendKey的input,但它似乎不工作。

这是我现在macros观的底部。

myPath = some path that I have file_loc = Application.GetSaveAsFilename(myPath, fileFilter:="Text Files (*.txt), *.txt") wb.SaveAs Filename:=file_loc, FileFormat:=xlText wb.Close 

任何帮助将非常感激!

谢谢你的答案ThunderFrame! 我改变了我的VBA代码的结尾以下,它的工作!

 Application.DisplayAlerts = False file_loc = some path that I have wb.SaveAs Filename:=file_loc, FileFormat:=xlText wb.Close Application.DisplayAlerts = True Application.ScreenUpdating = True 

一定要把Application.DisplayAlerts = False禁用popup窗口“你确定要保存这个文件吗?”