On Sun, 10 Jun 2018 03:24:34 -0700 (PDT),
moindu105@gmail.com wrote:
How can I convert auto page numbers into plain text.
ActiveDocument.Range.ListFormat.ConvertNumbersToText does not work for >auto page numbers.
The following was extracted from the Microsoft MVP web site, mvps.org.
While the macro itself does not do what you want, the introduction
provides a big clue how to do that. You might want to visit the site
for additional hints.
Copy a field code as normal text
When you need to prepare documentation that discusses field codes,
such as this web-site, it can be very tricky if you want to show
examples of field codes. Because when you copy and paste a field code,
what you normally get is not the text, but the field result! The
following two macros will copy the field you currently have selected
in your document and either insert it as text (Word 6/7) or place it
on the clipboard so that it can be pasted anywhere (Word 97). Sub MAIN
'Macro code for Word6/7
ScreenUpdating 0
CurrSetting = ViewFieldCodes()
If CurrSetting <> - 1 Then ViewFieldCodes 1
Fieldstring$ = Selection$()
NewString$ = ""
For X = 1 To Len(Fieldstring$)
CurrChar$ = Mid$(Fieldstring$, X, 1)
Select Case CurrChar$
Case Chr$(19)
CurrChar$ = "{"
Case Chr$(21)
CurrChar$ = "}"
Case Else
End Select
NewString$ = NewString$ + CurrChar$
Next X
CharRight : InsertPara
Insert NewString$
ViewFieldCodes CurrSetting
End Sub
Sub FieldCodeToString()
'Macro code for Word97
Dim Fieldstring As String, NewString As String
Dim CurrSetting As Boolean, fcDisplay As Object
Dim MyData As DataObject
NewString = ""
Set fcDisplay = ActiveWindow.View
Application.ScreenUpdating = False
CurrSetting = fcDisplay.ShowFieldCodes
If CurrSetting <> True Then fcDisplay.ShowFieldCodes = True
Fieldstring = Selection.Text
For X = 1 To Len(Fieldstring)
CurrChar = Mid(Fieldstring, X, 1)
Select Case CurrChar
Case Chr(19)
CurrChar = "{"
Case Chr(21)
CurrChar = "}"
Case Else
End Select
NewString = NewString + CurrChar
Next X
Set MyData = New DataObject
MyData.SetText NewString
MyData.PutInClipboard
fcDisplay.ShowFieldCodes = CurrSetting
End Sub
--
Remove del for email
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)