Results 1 to 3 of 3

Thread: [RESOLVED] Date format/calculation issues with Word 2003 userform

Threaded View

  1. #1

    Thread Starter
    Lively Member New2vba's Avatar
    Join Date
    Sep 2005
    Location
    UK
    Posts
    95

    Resolved [RESOLVED] Date format/calculation issues with Word 2003 userform

    Don't mean to take advantage of the free and much appreciated help, but I'm stuck again!

    Can anybody help?

    I have a Word 2003 userform that includes some text boxes. When the form is initialised, I insert the date into one of these boxes using the following:

    VB Code:
    1. txtDate.Value = Format(Date, "dd/mm/yy")
    When the form is completed and a command button is pressed, the forms values and some derived values are inserted into the Word document using bookmarks. One of these derived values is the date + 30 days, which is what I am having a problem with.

    I have used several sample pieces of code, but can't seem to get it to work - the form generates an error everytime. The latest code I have (which doesn't work) is:

    VB Code:
    1. Dim strValidity As Date
    2.         strValidity = Format$((txtDate.Value + 30), "dd-mm-yy")
    I also want to set the original text box (txtDate) format to dd/mm/yy similar to that used in Excel so, for example, if the user enters a new (shorthand) date, such as "15-12", it will be interpretted as "15/12/05"

    Any help would be appreciated.
    Last edited by New2vba; Dec 18th, 2005 at 09:12 AM.

Posting Permissions

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



Click Here to Expand Forum to Full Width