+ Reply to Thread
Results 1 to 4 of 4

FORMAT not working for Date to text as expected

Hybrid View

JimSnyder FORMAT not working for Date... 01-31-2013, 04:57 PM
oeldere Re: FORMAT not working for... 01-31-2013, 05:26 PM
JimSnyder Re: FORMAT not working for... 01-31-2013, 05:30 PM
JimSnyder Re: FORMAT not working for... 01-31-2013, 05:29 PM
  1. #1
    Registered User
    Join Date
    01-31-2013
    Location
    Columbus, Ohio, USA
    MS-Off Ver
    Excel 2010
    Posts
    5

    FORMAT not working for Date to text as expected

    I used to know how to do this, but have been away for too long. I have an Excel 2010 macro I am working on that spits out a fixed field file as it's final output. The file is generated daily and is FTP'ed daily to the client's server. The client wants the format to be INSPECTION2013030154726.TXT. I was using the format function with a format, but the date and time are unchanged from system settings:

        todayDate = Format(Now(), yyyymmdd)
        todayTime = Format(Now(), hhmmss)
    I am still playing with it, but not remembering how to do it. Any clues?

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: FORMAT not working for Date to text as expected

    Not sure about it, but you can give it a try.

    See the red text.

    todayDate = Format(Now(), "yyyymmdd")
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Registered User
    Join Date
    01-31-2013
    Location
    Columbus, Ohio, USA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: FORMAT not working for Date to text as expected

    That was part of it. Much thanks!

    Quote Originally Posted by oeldere View Post
    Not sure about it, but you can give it a try.

    See the red text.

    todayDate = Format(Now(), "yyyymmdd")

  4. #4
    Registered User
    Join Date
    01-31-2013
    Location
    Columbus, Ohio, USA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: FORMAT not working for Date to text as expected

    SOLVED!

        Dim todayDate As Date
        Dim todayTime As Date
        Dim yestDate As Date
    ...should hyave been...

        Dim todayDate As String
        Dim todayTime As String
        Dim yestDate As String

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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