How to pass unique custom file name to Save Dialog
I have an Excel template and when the user saves his workfile, I would like
to generate an unique file and pass it to the save dialog. Any help is appreciated. |
How to pass unique custom file name to Save Dialog
You can use the SaveAs method and set your file name up as a combination of
User Name, topic and date. You and use the InputBox method to get the user name as a variable and use the format function to set the date as a string. userName = InputBox("Enter your name (1st or last?)", "User Name" fName = userName & Format(Now, "dmmmyy") & "Topic" wb.SaveAs fileName:=fName "ExcelQ" wrote: I have an Excel template and when the user saves his workfile, I would like to generate an unique file and pass it to the save dialog. Any help is appreciated. |
How to pass unique custom file name to Save Dialog
You will need to add the file extension (.xls, .xlc, etc.) to your fName.
"ExcelQ" wrote: I have an Excel template and when the user saves his workfile, I would like to generate an unique file and pass it to the save dialog. Any help is appreciated. |
How to pass unique custom file name to Save Dialog
Or you could use this:
Set NewBook = Workbooks.Add fName = Application.GetSaveAsFilename NewBook.SaveAs Filename:=fName which adds a new workbook and then displays the SaveAs Dialog Box so you can enter any file name you like and choose the type file extension. "ExcelQ" wrote: I have an Excel template and when the user saves his workfile, I would like to generate an unique file and pass it to the save dialog. Any help is appreciated. |
All times are GMT +1. The time now is 02:28 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com