View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
JLatham JLatham is offline
external usenet poster
 
Posts: 2,203
Default Save File in Desired Location & Name

Mine is a bit different from Gary''s: it uses Environ$("USERPROFILE") to
return the drive and folder and your name portion of the path. This would
cause it to save the file in the "My Documents\Reports\" folder for whoever
logged into the computer. I also re-arranged the format of the date so that
it appears as YYYY-MM-DD with month and day both being 2-digit values. This
will cause the files to be presented to you in a file browser in order by
date properly, if that's of any importance/use to you:

Sub SaveMyFile()

ActiveWorkbook.SaveAs _
Environ$("USERPROFILE") & "\My Documents\Reports\Tariff IHE - " _
& Format(Now() - 1, "yyyy-mm-dd")

End Sub

"Kam" wrote:

Hi,

Need ur help to design macro which can save the file in desired location &
save with desired name. I do run a Macro on daily basis, which pulls data
from system based on Yesterday dates. Can you please write a macro.

File Name Should be : Tariff IHE - "Yesterday Date"
File Location : C:My Documents/Reports/

Best Regards,
Kam