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
-
Linux Mint Debian Edition 7 gets OEM support, death of Ubuntu-based Mint ?
by
Alex5723
17 minutes ago -
No Newsletters since 27 January (Awaiting moderation)
by
rog7
45 minutes ago -
No Newsletters since 27 January (Awaiting moderation)
by
rog7
46 minutes ago -
Windows Update “Areca Technology Corporation – System – 6.20.0.41”
by
Bruce
1 hour, 26 minutes ago -
Google One Storage Questions
by
LHiggins
2 hours, 37 minutes ago -
Button Missing for Automatic Apps Updates
by
pmcjr6142
8 minutes ago -
Ancient SSD thinks it’s new
by
WSila
6 hours, 36 minutes ago -
Washington State lab testing provider exposed health data of 1.6 million people
by
Nibbled To Death By Ducks
10 hours, 36 minutes ago -
WinRE KB5057589 fake out
by
Susan Bradley
3 hours, 55 minutes ago -
The April 2025 Windows RE update might show as unsuccessful in Windows Update
by
Susan Bradley
16 hours, 47 minutes ago -
Firefox 137
by
Charlie
1 hour, 24 minutes ago -
Whisky, a popular Wine frontend for Mac gamers, is no more
by
Alex5723
22 hours, 59 minutes ago -
Windows 11 Insider Preview build 26120.3863 (24H2) released to BETA
by
joep517
23 hours, 11 minutes ago -
Windows 11 Insider Preview build 26200.5551 released to DEV
by
joep517
23 hours, 14 minutes ago -
New Windows 11 PC setup — can I start over in the middle to set up a local id?
by
ctRanger
16 hours, 19 minutes ago -
Windows 11 Insider Preview Build 26100.3902 (24H2) released to Release Preview
by
joep517
1 day, 2 hours ago -
Oracle kinda-sorta tells customers it was pwned
by
Nibbled To Death By Ducks
1 day, 8 hours ago -
Global data centers (AI) are driving a big increase in electricity demand
by
Kathy Stevens
1 day, 19 hours ago -
Office apps read-only for family members
by
b
1 day, 21 hours ago -
Defunct domain for Microsoft account
by
CWBillow
1 day, 18 hours ago -
24H2??
by
CWBillow
1 hour, 8 minutes ago -
W11 23H2 April Updates threw ‘class not registered’
by
WindowsPersister
1 day, 3 hours ago -
Master patch listing for April 8th, 2025
by
Susan Bradley
7 hours, 28 minutes ago -
TotalAV safety warning popup
by
Theodore Nicholson
18 hours, 1 minute ago -
two pages side by side land scape
by
marc
3 days, 19 hours ago -
Deleting obsolete OneNote notebooks
by
afillat
3 days, 21 hours ago -
Word/Outlook 2024 vs Dragon Professional 16
by
Kathy Stevens
3 days ago -
Security Essentials or Defender?
by
MalcolmP
3 days, 3 hours ago -
April 2025 updates out
by
Susan Bradley
42 minutes ago -
Framework to stop selling some PCs in the US due to new tariffs
by
Alex5723
2 days, 20 hours 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.