Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Save workbook via Command Button????


I have a workbook with a command button and need to save the workbook
with a date as the file name. The date is in cell "A5" and the file I
need to save it to is "Midtown Farm". Can anyone help please???


--
Chris Watson
------------------------------------------------------------------------
Chris Watson's Profile: http://www.excelforum.com/member.php...fo&userid=4700
View this thread: http://www.excelforum.com/showthread...hreadid=525589

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Save workbook via Command Button????

Do you mean you have a file you want to save called 'Midtown Farm' and
you want to append the date in cell 'A5' to the end of the filename?
If so and the onClick event of the command button triggers the save
operation then you could do something like this:

Private Sub CommandButton1_Click()

Dim sDate as string

sDate = Format(Activesheet.Range("A5").Value, "yyyymmdd")

Thisworkbook.SaveAs "Midtown Farm_" & sDate

End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Save workbook via Command Button????


This works fine but What I want it to do is save the workbook in
folder call Midtown Farm in My documents, is this possible???

--
Chris Watso
-----------------------------------------------------------------------
Chris Watson's Profile: http://www.excelforum.com/member.php...nfo&userid=470
View this thread: http://www.excelforum.com/showthread.php?threadid=52558

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Save workbook via Command Button????

Sorry I misunderstood. In which case:

Thisworkbook.SaveAs "C:\My Documents\Midtown Farm\" & sDate

A note of caution however: 'My Documents' is not always where you think
it is. If you are on a standalone desktop then it is probably where
I've indicated, if you are on a corporate network then it may well be
on a network drive. To resolve the location open Explorer and
right-click-Properties on 'My Documents' the 'Target' tab will show
you the full path to the folder and then you just stick that in the
SaveAs command as I've shown.

HTH

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
Command Button Save As Application.ExecuteExcel4Macro ("SAVE.AS?() Paul Dennis Excel Discussion (Misc queries) 5 September 18th 06 05:34 PM
Command Button Prompt Save As? Rich Excel Discussion (Misc queries) 3 May 17th 06 02:33 PM
How to create command button to save the dates and time Ken Vo Excel Discussion (Misc queries) 6 January 5th 06 04:18 AM
How do I make Command button ( Save & Exit) for Excel Abutaha Excel Programming 1 November 16th 05 10:39 PM
Command Button to Save As Workbook... RPIJG[_13_] Excel Programming 1 May 12th 04 08:59 PM


All times are GMT +1. The time now is 08:19 AM.

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"