VBA Use Windows File Dialog Box to Create a Workbook

Hi

I'm working on a VBA application and would like to let the user create a new Workbook and choose where to save it using the well know Windows Dialog boxes. I can find examples of msoFileDialogFilePicker so select a file or another method for selecting a folder but couldn't see anything to actually save a new Workbook. Could someone point me in the right direction if they know.

Thanks
PJ0302917Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rgonzo1971Commented:
Hi,

pls try
 Filename = Application.GetSaveAsFilename( _ 
    fileFilter:="Excel Files (*.xls), *.xl") 
    If Filename <> False Then 
        ActiveWorkbook.SaveAs Filename 
    End If 

Open in new window

Regards
0
PJ0302917Author Commented:
Hi

Thanks for the help, this works. At the moment its saving the current Workbook and I need to create a new empty workbook but I'll see if I can get it working. Thanks for the help
0
Rgonzo1971Commented:
then try
Sub Macro()
  Filename = Application.GetSaveAsFilename( _
    fileFilter:="Excel Files (*.xl*), *.xl*")
    If Filename <> False Then
        Set wb = Workbooks.Add
        wb.SaveAs Filename
        'wb.Close
    End If

End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PJ0302917Author Commented:
That worked a treat, thank you Rgonzo
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VBA

From novice to tech pro — start learning today.

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.