I've been trying to add a format to a bookmarked name with no success. I'm
actually creating a document from the AS/400. I have a field that currently
prints like xxxxxxxxxxxxxx I want to have it displayed like this
xxx-xxxx-xxx-xxxx The bookmark is acctno. Any suggestions?
Word doesn't have any text formatting facility like that, it can only do
numbers; and the format you want is not numeric.
> I've been trying to add a format to a bookmarked name with no success.
> I'm
> actually creating a document from the AS/400. I have a field that
> currently
> prints like xxxxxxxxxxxxxx I want to have it displayed like this
> xxx-xxxx-xxx-xxxx The bookmark is acctno. Any suggestions?
Use the following code:
Dim accountnum As Range, Account As String
With ActiveDocument
Set accountnum = .Bookmarks("AcctNo").Range
Account = .Bookmarks("AcctNo").Range.Text
accountnum.Text = Left(Account, 3) & "-" & Mid(Account, 4, 4) & "-" &
Mid(Account, 8, 3) & "-" & Right(Account, 4)
.Bookmarks.Add Name:="AcctNo", Range:=accountnum
End With

Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
> I've been trying to add a format to a bookmarked name with no success.
> I'm
> actually creating a document from the AS/400. I have a field that
> currently
> prints like xxxxxxxxxxxxxx I want to have it displayed like this
> xxx-xxxx-xxx-xxxx The bookmark is acctno. Any suggestions?