• Display date on useform… (excel97)

    Author
    Topic
    #358659

    Hello again..

    I have succeed doing this..the problem is the date format and the time format..but problem occured again…

    1. when i use “dd mmm yyyy format” , it still display as “m d yy” ( i want it to look like this 02 July 2001 but it show 7/2/01 )

    2. how can i display time without date i.e
    i want it show like this : 4:54:45 PM and not like : 8/2/01 4:54:45 PM

    3. is it possible to add text after the date..i.e..
    ” 02 july 2001 4:54:45 PM – NiuB like you ”

    the conclusion is..how can i display all this thing to be display as the format that i like.. i.e :
    ” 02 July 2001 4:54:45 PM – NiuB like you ”

    I meant using single text box only instead like what am i doing right now using two text boxes and still can’t get the result

    thanks a zillion

    here is my code..

    Private Sub UserForm_activate()

    TextBox1.Value = “The time is now : ” & Now
    TextBox2.Value = “Todays date is : ” & Date

    TextBox1.Value = Format(TextBox1.Value, “hh:mm AM/PM “)
    TextBox2.Value = Format(TextBox2.Value, “dd mmmm yyyy “)

    End Sub

    Viewing 0 reply threads
    Author
    Replies
    • #535615

      NiuB

      Try just the followint 2 lines !!

      TextBox1.Value = Format(Now(), "hh:mm AM/PM ")
      TextBox2.Value = Format(Now(), "dd mmmm yyyy ")

      The following will give the message you want (you may not need a textbox) :-

      Sub Greeting()
          Dim strMessage As String
          strMessage = Format(Now(), "d MMMM yyyy, hh:mm AM/PM") & " NiuB Like You"
          MsgBox strMessage
      End Sub

      Andrew C

      • #535623

        As I told you before Andrew..you such a doll..
        It works like magic..lol..many thanks and thanks again Andrew..regards

    Viewing 0 reply threads
    Reply To: Display date on useform… (excel97)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: