+ Reply to Thread
Results 1 to 3 of 3

Format Text Box as "dd/mm/yyyy"

Hybrid View

adam2308 Format Text Box as... 11-12-2009, 12:37 PM
Andy Pope Re: Format Text Box as... 11-12-2009, 01:09 PM
adam2308 Re: Format Text Box as... 11-12-2009, 01:15 PM
  1. #1
    Forum Contributor
    Join Date
    02-20-2009
    Location
    Manchester, England
    MS-Off Ver
    Excel 2007
    Posts
    467

    Format Text Box as "dd/mm/yyyy"

    Can someone tell me what i am doing wrong on the attached example. All i want to do is click the 'show form' button then i click the little calendar icon which displays a calendar on another form. When i click the date the format of the date goes in US stlye. I would like the format to be "dd/mm/yyyy".

    Thanks,
    Adam.
    Attached Files Attached Files
    Last edited by adam2308; 11-12-2009 at 01:16 PM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,482

    Re: Format Text Box as "dd/mm/yyyy"

    that's how the control is written, US date format.

    So you need to format the date how you want.
    Also pull the selected date from the userform rather than push, that way you can use the calendar form from other controls and userforms.

    userform frmInput code

    Private Sub Calendar1_Click()
        frmInput.Hide
        With frmCalendar
            .Show
            With .Calendar1
                Me.TextBox1.Text = VBA.Format(DateSerial(.Year, .Month, .Day), "dd/mm/yyyy")
            End With
        End With
        frmInput.Show
    
    End Sub
    userform frmCalendar code

    Private Sub Calendar1_Click()
    
        frmCalendar.Hide
        
    End Sub
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Contributor
    Join Date
    02-20-2009
    Location
    Manchester, England
    MS-Off Ver
    Excel 2007
    Posts
    467

    Re: Format Text Box as "dd/mm/yyyy"

    Perfick!! Cheers Andy!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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