In a paragraph there are a few FormFields (FF) to be filled out by an end-user. One of the FFs is a datefield, formatted as “dd-MM-yyyy”. Sometimes there’s no room on a line to hold the complete date and FF is abbriviated. The users don’t like that. Is there a (preferably easy) way to make sure this date FF is not abbreviated and kept together on one (the next) line?
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Keep FormField contents on 1 line (WinXP NL / Off2003 NL)
Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » Keep FormField contents on 1 line (WinXP NL / Off2003 NL)
- This topic has 14 replies, 3 voices, and was last updated 20 years, 1 month ago.
Viewing 1 reply threadAuthorReplies-
WSTonyE
AskWoody LoungerFebruary 21, 2005 at 8:43 am #929950Hi Jan
You can put the date field inside an EQ field as shown in post 409788
WSHansV
AskWoody LoungerFebruary 21, 2005 at 9:13 am #929957Unfortunately, I can’t think of a way to do this. The .TextInput.Format property of a form field is read-only, so you can’t replace the hyphens in the date format with non-breaking hyphens.
Instead of using form fields, you could create a UserForm (in VBA) to let the users enter the date (and other information). You can then place the date in the document with non-breaking hyphens.-
WSJanB
AskWoody LoungerFebruary 21, 2005 at 9:40 am #929960Thanks Hans. I was afraid of that.
But I came up with the idea of an ExitMacro using Selection.Information(wdVerticalPositionRelativeToPage). If this is different for the first and last position in the FFs contents, then it’s split over 2 lines. And that could be solved by putting a soft return just in front of the FF. I have to work it out in detail, but I there are possibilities, I think.
-
WSJanB
AskWoody LoungerFebruary 21, 2005 at 11:19 am #929966I have it working. And a lot easier than I thought up front. There’s a FormField named Date_exp (expiration) in a paragraph of the doc that needs to be on 1 line. Chr(11) is a soft return (Shift+Enter). ProtectionOff and ProtectionOn are custom Subs that do what their names suggest…
Public Sub ExitDate_exp() Dim dblStart As Double Dim dblEnd As Double Dim dblLength As Double dblLength = Len(ActiveDocument.FormFields("Date_exp").Result) With Selection .GoTo What:=wdGoToBookmark, Name:="Date_exp" dblStart = .Information(wdVerticalPositionRelativeToPage) .MoveRight Count:=dblLength dblEnd = .Information(wdVerticalPositionRelativeToPage) If dblStart dblEnd Then .GoTo What:=wdGoToBookmark, Name:="Date_exp" .Collapse Direction:=wdCollapseStart .MoveLeft ProtectionOff .InsertBefore Chr(11) ProtectionOn End If End With End Sub
-
WSHansV
AskWoody Lounger -
WSJanB
AskWoody LoungerFebruary 21, 2005 at 11:50 am #929968 -
WSJanB
AskWoody LoungerFebruary 21, 2005 at 12:05 pm #929971I got it right this time…
I removed the last .MoveLeft so that the Chr(11) is inserted as the first character into the FormField.
Then added to the top of the Sub a test to see if the first character of the content of the FormFiled is a Chr(11) and if so, remove it and replace the old content with the new one. Anything else I missed Hans?Public Sub ExitDate_exp() Dim dblStart As Double Dim dblEnd As Double Dim dblLength As Double Dim strTemp As String strTemp = ActiveDocument.FormFields("Date_exp").Result If Left(strTemp, 1) = Chr(11) Then strTemp = Mid(strTemp, 2) ActiveDocument.FormFields("Date_exp").Result = strTemp End If dblLength = Len(ActiveDocument.FormFields("Date_exp").Result) With Selection .GoTo What:=wdGoToBookmark, Name:="Date_exp" dblStart = .Information(wdVerticalPositionRelativeToPage) .MoveRight Count:=dblLength dblEnd = .Information(wdVerticalPositionRelativeToPage) If dblStart dblEnd Then .GoTo What:=wdGoToBookmark, Name:="Date_exp" .Collapse Direction:=wdCollapseStart ProtectionOff .InsertBefore Chr(11) ProtectionOn End If End With End Sub
-
WSHansV
AskWoody LoungerFebruary 21, 2005 at 12:12 pm #929973The only thing I can think of is that if you have other form fields before Date_exp in the same paragraph, you may have to do this in their On Exit macro too – the position of Date_exp might shift if those form fields are edited. If there are no form field before Date_exp in the same paragraph, there is no problem.
-
WSJanB
AskWoody Lounger -
WSHansV
AskWoody Lounger -
WSJanB
AskWoody Lounger -
WSHansV
AskWoody Lounger
-
-
-
Viewing 1 reply thread -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Windows 11 Windows Updater question
by
Tex265
1 hour, 28 minutes ago -
Key, Key, my kingdom for a Key!
by
RetiredGeek
6 hours, 5 minutes ago -
Registry Patches for Windows 10
by
Drcard:))
10 hours, 36 minutes ago -
Cannot get line length to NOT wrap in Outlining in Word 365
by
CWBillow
10 hours, 48 minutes ago -
DDU (Display Driver Uninstaller) updates
by
Alex5723
3 hours, 58 minutes ago -
Align objects on a OneNote page
by
CWBillow
16 hours, 3 minutes ago -
OneNote Send To button?
by
CWBillow
16 hours, 47 minutes ago -
WU help needed with “Some settings are managed by your organization”
by
Peobody
1 day, 1 hour ago -
No Newsletters since 27 January
by
rog7
21 hours, 17 minutes ago -
Linux Mint Debian Edition 7 gets OEM support, death of Ubuntu-based Mint ?
by
Alex5723
1 hour, 53 minutes ago -
Windows Update “Areca Technology Corporation – System – 6.20.0.41”
by
Bruce
33 minutes ago -
Google One Storage Questions
by
LHiggins
1 hour, 54 minutes ago -
Button Missing for Automatic Apps Updates
by
pmcjr6142
1 hour, 14 minutes ago -
Ancient SSD thinks it’s new
by
WSila
6 hours, 29 minutes ago -
Washington State lab testing provider exposed health data of 1.6 million people
by
Nibbled To Death By Ducks
1 day, 16 hours ago -
WinRE KB5057589 fake out
by
Susan Bradley
1 day, 9 hours ago -
The April 2025 Windows RE update might show as unsuccessful in Windows Update
by
Susan Bradley
1 day ago -
Firefox 137
by
Charlie
2 hours, 53 minutes ago -
Whisky, a popular Wine frontend for Mac gamers, is no more
by
Alex5723
2 days, 4 hours ago -
Windows 11 Insider Preview build 26120.3863 (24H2) released to BETA
by
joep517
2 days, 4 hours ago -
Windows 11 Insider Preview build 26200.5551 released to DEV
by
joep517
2 days, 4 hours ago -
New Windows 11 PC setup — can I start over in the middle to set up a local id?
by
ctRanger
1 day ago -
Windows 11 Insider Preview Build 26100.3902 (24H2) released to Release Preview
by
joep517
2 days, 8 hours ago -
Oracle kinda-sorta tells customers it was pwned
by
Nibbled To Death By Ducks
2 days, 14 hours ago -
Global data centers (AI) are driving a big increase in electricity demand
by
Kathy Stevens
3 days ago -
Office apps read-only for family members
by
b
3 days, 3 hours ago -
Defunct domain for Microsoft account
by
CWBillow
3 days ago -
24H2??
by
CWBillow
1 day ago -
W11 23H2 April Updates threw ‘class not registered’
by
WindowsPersister
20 hours, 23 minutes ago -
Master patch listing for April 8th, 2025
by
Susan Bradley
1 day ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.