View Single Post
 
Old 04-14-2017, 01:56 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote