#16
|
||||
|
||||
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] |
#17
|
|||
|
|||
So, I've inserted the code after "StrTxt = ActiveDocument.Path & Application.PathSeparator & StrTxt" an now, instead of "string has more than 255 characters" i receive the 5487 error: "Word cannot complete the save due to a file permission error", but it stops where it used to stop before ("string too long"). it generates the exact 3 documents it used to generate before but with a different error.
|
#18
|
||||
|
||||
See my edits to my previous reply.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Tags |
vba microsoft word 2013 |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Word VBA - Split Document By Headings - Save File Name As Heading Name | jc491 | Word VBA | 7 | 01-21-2022 11:04 AM |
split word document based on bookmarks with each new document title of the bookmark | megatronixs | Word VBA | 9 | 09-05-2020 02:29 PM |
Vba code to save document as pdf using document property text and rename folder. | staicumihai | Word VBA | 1 | 12-21-2015 07:39 AM |
How to save active document to SharePoint document library | Rose roon | Word VBA | 9 | 09-22-2015 10:53 PM |
How do I see one document map for each half of a split MS WORD 2010 document? | quickwin | Word | 3 | 07-09-2013 10:20 PM |