Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-11-2016, 09:38 AM
vera vera is offline Spell out a number without protecting a document Windows 7 64bit Spell out a number without protecting a document Office 2010 64bit
Novice
Spell out a number without protecting a document
 
Join Date: Feb 2016
Posts: 5
vera is on a distinguished road
Default Spell out a number without protecting a document

I'm looking for a way to spell out numbers (not currency) typed into a content control without protecting the document. I.e., if someone enters 31,000, "thirty-one thousand" would appear in front of it. I know how to do this with legacy forms but that requires me to protect the document. I'm already using a bunch of content controls and those who will be editing this template will be editing more areas than just those with content controls. Is there a way I can do this using content controls but without protecting the document?



I've played around with VBAs a few times so I understand the basics but the simpler, the better. If that's not possible, I will most likely need some explaining.

Also, if it makes a difference, this would be utilized in more than one location in the document.

Thank you!
Reply With Quote
  #2  
Old 03-11-2016, 02:40 PM
macropod's Avatar
macropod macropod is offline Spell out a number without protecting a document Windows 7 64bit Spell out a number without protecting a document Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

If you title the content control into which you input the number 'NumVal' and a Rich Text content control titled 'NumText' for the words, you could use a content control on exit macro like:
Code:
Private Sub Document_ContentControlOnExit(ByVal CCtrl As ContentControl, Cancel As Boolean)
Dim StrNum As String
With CCtrl
  StrNum = Trim(.Range.Text)
  If IsNumeric(StrNum) Then
  If .Title = "NumVal" Then
    With ActiveDocument
      .Fields.Add Range:=.SelectContentControlsByTitle("NumText")(1).Range, _
        Type:=wdFieldEmpty, Text:="=" & StrNum & " \* CardText", PreserveFormatting:=False
      .SelectContentControlsByTitle("NumText")(1).Range.Fields.Unlink
    End With
  End If
  End If
End With
End Sub
no protection required.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 05-20-2016, 07:35 AM
vera vera is offline Spell out a number without protecting a document Windows 7 64bit Spell out a number without protecting a document Office 2010 64bit
Novice
Spell out a number without protecting a document
 
Join Date: Feb 2016
Posts: 5
vera is on a distinguished road
Default

This worked perfectly. Thank you!
Reply With Quote
Reply

Tags
content control, vba, word 2010



Similar Threads
Thread Thread Starter Forum Replies Last Post
Protecting document brucemc777 Word 2 01-23-2016 02:38 PM
Spell out a number without protecting a document Protecting a document; allow sections to be edited - spacing in table cells when protected dwciardi Word 3 09-30-2015 01:03 PM
Spell out a number without protecting a document Cant type into content controls in a form after protecting document using macro rgburridge Word VBA 4 01-27-2015 02:37 PM
Disabling content controls and protecting document sections. Catty Word VBA 2 11-29-2013 05:10 AM
Protecting Word Document by restricting access permissions! user Word 0 11-20-2008 01:21 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:18 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft