Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Kam Kam is offline
external usenet poster
 
Posts: 57
Default Save File in Desired Location & Name

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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Save File in Desired Location & Name

Change the names to protect the innocent:

Sub SaveProperly()
Dim wb As Workbook, dt As String
Set wb = ActiveWorkbook
st = Format(Date - 1, "mm_dd_yyyy")
fname = "C:\Documents and Settings\jravensw\Desktop\Tariff IHE - " & st &
".xls"
MsgBox st
wb.SaveAs Filename:=fname
End Sub

--
Gary''s Student - gsnu200909


"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

  #3   Report Post  
Posted to microsoft.public.excel.misc
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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to save the same file in other location ravscares Excel Discussion (Misc queries) 2 July 22nd 08 03:10 PM
How change the file location that I save my files to? John Scinto[_2_] Excel Discussion (Misc queries) 1 December 26th 07 01:14 AM
have excel prompt for a file name and save location Dave F Excel Discussion (Misc queries) 6 March 20th 07 06:35 PM
Using Macro to Save Copy of File to New Location Chris Z Excel Discussion (Misc queries) 3 September 12th 06 11:26 PM
Existing file not defaulting to same location using "Save As" Daniel918 Excel Discussion (Misc queries) 1 June 1st 05 12:55 AM


All times are GMT +1. The time now is 07:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"