![]() |
|
#1
|
|||
|
|||
|
Hey Guys, I've looked everywhere for an answer to this one. I have a dropdown form field that I need the text to be italic. However when I unlink the fields it looses the format and returns to regular text. Suggestions? Thanks- |
|
#2
|
||||
|
||||
|
What you describe is the normal behaviour, however you can establish whether the font is italic before unlinking then reapply the italics if required e.g.
Code:
Sub UnlinkFormFields()
Dim oFF As FormField
Dim oRng As Range
Dim i As Long
If Not ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Unprotect Password:=""
End If
For Each oFF In ActiveDocument.FormFields
i = Len(oFF.Result)
Set oRng = oFF.Range
If oFF.Range.Font.Italic = True Then
oRng.Fields.Unlink
oRng.End = oRng.End + i
oRng.Font.Italic = True
Else
oRng.Fields.Unlink
End If
Next oFF
lbl_Exit:
Set oFF = Nothing
Set oRng = Nothing
Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
#3
|
|||
|
|||
|
Thanks-works great-
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Retain source format even on combination of multiple documents of different formats
|
G.Anusha | Word | 12 | 12-14-2021 03:31 PM |
retain form fields upon conversion to pdf
|
billy123 | Word | 1 | 05-24-2015 07:04 PM |
Unable to format fields
|
pro3carp3 | Word | 1 | 03-04-2014 02:49 PM |
| 3x1 Table: text in fields loses paragraph format when being bulleted | madasco | Word | 3 | 06-07-2013 06:44 AM |
Format Fields in Word 2010
|
Dave013 | Word | 2 | 01-11-2013 01:46 AM |