• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 875
  • Last Modified:

Open the SaveAs dialog with VBA in Excel

From Excel, I have written VBA code that will save a file with a predetermined filename.  

If that filename already exists, I need VBA to open the SaveAs dialog window and supply a suggested filename.

How do I open the SaveAs dialog with VBA code?

0
hthart
Asked:
hthart
  • 2
  • 2
1 Solution
 
Rory ArchibaldCommented:
application.dialogs(xlDialogSaveAs).Show "C:\test"

Open in new window

you can add a filename as well if required.
0
 
hthartAuthor Commented:
This works great, but I also need it to default the Save as Type combobox toshow *.xls.

Is that possible?
0
 
Rory ArchibaldCommented:
Try adding ,1 to the end:
application.dialogs(xlDialogSaveAs).Show "C:\test", 1

Open in new window

0
 
hthartAuthor Commented:
It is absolutely perfect!

Thank you
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now