View Single Post
  #2   Report Post  
Ron de Bruin
 
Posts: n/a
Default Macro Save File (Unique file name)

Hi

In my Mail examples i always use the date and time

Dim strdate As String
strdate = Format(Now, "dd-mm-yy h-mm-ss")

For a example see this one for example
http://www.rondebruin.nl/mail/folder1/mail2.htm

--
Regards Ron de Bruin
http://www.rondebruin.nl


"SJC" wrote in message ...
I currently have a code which I have listed below which will save a file when
the user selects the button. I have some users who will need to save two or
more files, which directs them to overwrite the file since currently, there
is no identifier in the file name. The indentifier that I would like to add
is on another spreadsheet in the same workbook. (Worksheet name:
Intro--Start Here; cell: G13)

Does anyone know how I can add this information to the filename so that each
file saved will have a unique name? Thanks for any suggestions.


Dim strPath As String
Dim strFileName As String

strPath = Application.DefaultFilePath & "\"
strFileName = "xxx"

ActiveWorkbook.SaveAs strPath & strFileName, FileFormat:= _
xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
, CreateBackup:=False
ActiveWindow.Close
Sheets("Intro--Start Here").Select
MsgBox ("xxx")

End Sub