Microsoft Office Tutorials and References
In Depth Information
Displaying a Number in Millions as Text
'...otherwise it has to precede the "/100" as a number¶
InsertFieldInFieldCode rng, szBkm, "= bkm * 100 \# " & _¶
szQuotes & "00" & szQuotes¶
InsertFieldInFieldCode rng, szBkm, "r"¶
'Format the rest as dollartext¶
InsertFieldInFieldCode rng, szBkm, "r \* dollartext"¶
fld.Update¶
End Sub¶
' * * * * *¶
Function InsertFieldInFieldCode( _¶
ByRef rng As Word.Range, _¶
ByRef szBkm As String, _¶
ByRef szField As String, _¶
Optional ByRef PF As Boolean = False) As Boolean¶
InsertFieldInFieldCode = False¶
With rng.Find¶
.Text = szBkm¶
.Execute¶
If .Found Then¶
ActiveDocument.Fields.Add _¶
Range:=rng, Text:=szField, _¶
PreserveFormatting:=PF¶
InsertFieldInFieldCode = True¶
End If¶
End With¶
End Function¶
' * * * * *¶
Sub UpdateAllFields()¶
'Variable declaration¶
Dim sty As Word.Range¶
Application.DisplayAlerts = wdAlertsNone¶
For Each sty In ActiveDocument.StoryRanges¶
sty.Fields.Update¶
Next¶
Application.DisplayAlerts = wdAlertsAll¶
End Sub¶
' * * * * *¶
Sub PasteFieldCodesAsText()¶
'Variable declaration¶
Dim rng As Word.Range¶
Dim FieldString As String¶
Dim NewString As String¶
Dim i As Long¶
Dim CurrChar As String¶
Dim CurrSetting As Boolean¶
Dim MyData As MSForms.DataObject¶
'Make the preparations¶
Set rng = Selection.Range¶
NewString = ""¶
Application.ScreenUpdating = False¶
Wrd
Search JabSto ::




Custom Search