There is only one place you should have inserted that code - between:
.MoveEnd wdCharacter, -1
and:
StrTxt = .Text
With that change, no filename will have more than 254 characters.
However, you also can't have a filename (including the extension) & path that is more than 255 characters. Accordingly, omit the above change and insert:
If Len(StrTxt) > 250 Then StrTxt = Left(StrTxt, 250)
after:
StrTxt = ActiveDocument.Path & Application.PathSeparator & StrTxt
EDIT: I note also that your 'question' on page 4 isn't terminated by a paragraph break - it's terminated by a manual line break instead. Although I could code around that, you really should fix the document.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
|