![]() |
#10
|
||||
|
||||
![]()
To do that, you would need to use code like:
Code:
Private Sub cmdOK_Click() Application.ScreenUpdating = False Dim BmkNm As String, NewTxt As String, BmkRng As Range BmkNm = "DateFiled" With ActiveDocument If .Bookmarks.Exists(BmkNm) Then Set BmkRng = .Bookmarks(BmkNm).Range BmkRng.Text = Format(dtDateFiled.Value, "MMMM ") & Ordinal(Format(dtDateFiled.Value, "DD")) & Format(dtDateFiled.Value, ", YYYY ") .Bookmarks.Add BmkNm, BmkRng Else MsgBox "Bookmark: " & BmkNm & " not found." End If End With Set BmkRng = Nothing Application.ScreenUpdating = True Unload Me End Sub Function Ordinal(Val As Integer) As String Dim strOrd As String If (Val Mod 100) < 11 Or (Val Mod 100) > 13 Then strOrd = Choose(Val Mod 10, "st", "nd", "rd") & "" Ordinal = Val & IIf(strOrd = "", "th", strOrd) End Function
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Tags |
date, format, userform |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
lukael | Excel Programming | 5 | 02-18-2014 05:20 AM |
Userform Code not quite right - help please | vbanovice | Word VBA | 1 | 09-29-2013 09:20 PM |
![]() |
leemoreau | Word VBA | 1 | 09-14-2013 06:01 AM |
VBA code to update record in Access 2003 using Userform in Excel | primmer3001 | Excel Programming | 0 | 08-29-2011 04:25 PM |
![]() |
webharvest | Word VBA | 5 | 06-21-2011 03:22 PM |