Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #16  
Old 04-14-2017, 01:56 AM
macropod's Avatar
macropod macropod is offline Save each split document with name from inside that document Windows 7 64bit Save each split document with name from inside that document Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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
  #17  
Old 04-14-2017, 02:12 AM
mihnea96 mihnea96 is offline Save each split document with name from inside that document Windows 7 32bit Save each split document with name from inside that document Office 2010 32bit
Novice
Save each split document with name from inside that document
 
Join Date: Apr 2017
Posts: 26
mihnea96 is on a distinguished road
Default

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.
Reply With Quote
  #18  
Old 04-14-2017, 02:47 AM
macropod's Avatar
macropod macropod is offline Save each split document with name from inside that document Windows 7 64bit Save each split document with name from inside that document Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

See my edits to my previous reply.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Tags
vba microsoft word 2013



Similar Threads
Thread Thread Starter Forum Replies Last Post
Save each split document with name from inside that document Word VBA - Split Document By Headings - Save File Name As Heading Name jc491 Word VBA 7 01-21-2022 11:04 AM
Save each split document with name from inside that document 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
Save each split document with name from inside that document 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

Other Forums: Access Forums

All times are GMT -7. The time now is 03:20 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft