+ Reply to Thread
Results 1 to 5 of 5

Save File with TimeStamp

  1. #1
    Registered User
    Join Date
    05-26-2019
    Location
    UK
    MS-Off Ver
    2016
    Posts
    50

    Save File with TimeStamp

    Hi All, I've got the below code which gives me "Type mismatch" on 'CStr'. Would you be so kind please and advise as to how I can save this file so that it follows the outlined format below?

    Please Login or Register  to view this content.
    Many thanks!

  2. #2
    Valued Forum Contributor
    Join Date
    08-03-2012
    Location
    Newcastle
    MS-Off Ver
    Excel 2007, 2010, 2013, 2016, Office 365
    Posts
    467

    Re: Save File with TimeStamp

    Hi Frennzyy

    You can't have filenames with a colon ":" character in it.
    Change it to a space or a dash character.
    How about
    timeStamp = format(Now, "dd-mm-yy hh-mm")
    fileName = "Test - " & Worksheets("MainTab").Range("E4").Text & "@" & timestamp

    zeddy

  3. #3
    Registered User
    Join Date
    05-26-2019
    Location
    UK
    MS-Off Ver
    2016
    Posts
    50

    Re: Save File with TimeStamp

    Hi zeddy, thanks for the reply.
    Please note that I did as you said but now I'm getting "Compile error: Wrong number of arguments or invalid property assignment" on 'format'.

    Thanks!

  4. #4
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,302

    Re: Save File with TimeStamp

    this format works for me

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    05-26-2019
    Location
    UK
    MS-Off Ver
    2016
    Posts
    50

    Re: Save File with TimeStamp

    Thank you both, they both work just fine, it simply turns out I had another sub called 'formula' that was causing the error...
    Last edited by Frenzyy; 05-27-2020 at 07:47 AM.

+ 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. Replies: 3
    Last Post: 01-31-2020, 01:16 PM
  2. Replies: 2
    Last Post: 11-09-2016, 02:23 PM
  3. Replies: 1
    Last Post: 09-05-2013, 02:39 PM
  4. How to save web query including timestamp
    By h41cyon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-15-2007, 12:13 AM
  5. [SOLVED] Getting timestamp from a file in Excel
    By Patrick in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 PM
  6. Getting timestamp from a file in Excel
    By Patrick in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  7. [SOLVED] Getting timestamp from a file in Excel
    By Patrick in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-25-2005, 12:05 PM

Tags for this Thread

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