![]() |
#8
|
||||
|
||||
![]() Quote:
Since it seems you have multiple bookmarks to update, I've merged this thread and your previous one, so you can see how the two examples we have so far can be made to work with some common bookmark-updating code. For the two examples so far we could use: Code:
Private Sub cmdOK_Click() Application.ScreenUpdating = False Dim StrOut As String StrOut = Format(dtDateFiled.Value, "MMMM DD, YYYY ") Call UpdateBookmark("DateFiled", StrOut) Select Case cboName.Value Case "Bob": StrOut = "1" Case "Cindy": StrOut = "2" Case "Peter": StrOut = "3" Case "Vanessa": StrOut = "4" End Select Call UpdateBookmark("Name", StrOut) Application.ScreenUpdating = True End Sub Code:
Sub UpdateBookmark(StrBkMk As String, StrTxt As String) Dim BkMkRng As Range With ActiveDocument If .Bookmarks.Exists(StrBkMk) Then Set BkMkRng = .Bookmarks(StrBkMk).Range BkMkRng.Text = StrTxt .Bookmarks.Add StrBkMk, BkMkRng End If End With Set BkMkRng = Nothing End Sub Call UpdateBookmark("DateFiled", Format(dtDateFiled.Value, "MMMM DD, YYYY "))
__________________
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 |