+ Reply to Thread
Results 1 to 6 of 6

Command button to save workbook with filename data from 2 cells??

  1. #1
    Registered User
    Join Date
    02-15-2016
    Location
    England
    MS-Off Ver
    2007
    Posts
    10

    Command button to save workbook with filename data from 2 cells??

    Hi
    I'm trying (without much success) to get a command button to save my current workbook with the file name "Status sheet" but also with the time (which will either be 0500 or 1530) and the current date, so the filename should be "Status Sheet 0500 15/02/2016"
    I've got this to partly do what I need but am struggling to get it to recognize whats in cell B1 and I don't know how to add the "Status Sheet" part of the filename?

    Can anyone offer me any advice?

    Private Sub CommandButton1_Click()
    ActiveWorkbook.SaveAs Filename:="\\defthw9000osto.ww002.net\WTS-redirect$\FlexSm\.WW002\Desktop\Daily Work\" & Sheets("Sheet1").Range("A1").Value & ("B1") & ".xlsm"
    End Sub

    Thanks Peeps

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Command button to save workbook with filename data from 2 cells??

    Your problem is quite simple.

    Excel reads "15/02/2016" as Folder 15, Sub folder 02, Sub Sub folder 2016.

    So try:-

    Please Login or Register  to view this content.
    Last edited by mehmetcik; 02-15-2016 at 03:03 PM.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Registered User
    Join Date
    02-15-2016
    Location
    England
    MS-Off Ver
    2007
    Posts
    10
    Thanks will give it a try!! 👍🏼

    Quote Originally Posted by mehmetcik View Post
    Your problem is quite simple.

    Excel reads "15/02/2016" as Folder 15, Sub folder 02, Sub Sub folder 2016.

    So try:-

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    02-15-2016
    Location
    England
    MS-Off Ver
    2007
    Posts
    10

    Re: Command button to save workbook with filename data from 2 cells??

    Ps could explain all the code so I can better understand it completely? 😁

  5. #5
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Command button to save workbook with filename data from 2 cells??

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    02-15-2016
    Location
    England
    MS-Off Ver
    2007
    Posts
    10

    Re: Command button to save workbook with filename data from 2 cells??

    Hi mehmetcik,

    Thanks for your help so far but I think we have crossed wires?

    What I was originally trying to achieve was to save a workbook with the file name "Status Sheet" but also need to identify it with the time & date (Time in A1 cell & date in B1 cell) I need to save this file twice a day the first time it will be called - Status Sheet 0500 16022016 and the next time I update cell A1 with the time 1530 and resave it hopefully as - Status Sheet 1530 16022016

    I originally wanted to save this file on a network drive but think I would be better off saving it to the current location it is in! If this is possible?

    Thanks
    Last edited by Owen1976; 02-16-2016 at 10:54 AM. Reason: Clarification

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Save data from one workbook to another by pressing a command button
    By SpeckM in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-29-2015, 10:22 AM
  2. Open/Save/Close Workbook via command button
    By nathan0519 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-31-2015, 11:24 PM
  3. Command button to open Save As dialogue box for new spreadsheet and copy data.
    By valhallaone in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-20-2013, 07:08 PM
  4. Replies: 0
    Last Post: 07-24-2013, 01:09 PM
  5. [SOLVED] command button: specified sheet copy and save as new workbook to specified location
    By Zlatko.Pan in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-15-2013, 12:28 PM
  6. Command button - to copy active sheet and not save current workbook
    By vjboaz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-22-2008, 05:23 PM
  7. Save workbook via Command Button????
    By Chris Watson in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-23-2006, 06:15 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1