Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-01-2019, 10:13 PM
Gingerbreadgrl Gingerbreadgrl is offline Macro to Split Documents Windows 10 Macro to Split Documents Office 2016
Novice
Macro to Split Documents
 
Join Date: Sep 2019
Posts: 3
Gingerbreadgrl is on a distinguished road
Default Macro to Split Documents

Hi there,



I am attempting to use the code you suggested in https://www.msofficeforums.com/word-...save-file.html, but I am getting the error "You are not allowed to edit this selection because its prohibited, run time 6124." When I hit debug it brings me to this code line:

range.formattedtext = rng.formattedtext

Is there a way to fix this? I would really like to use this macro.

Last edited by macropod; 09-01-2019 at 10:24 PM. Reason: Split to separate thread
Reply With Quote
  #2  
Old 09-01-2019, 10:18 PM
Gingerbreadgrl Gingerbreadgrl is offline Macro to Split Documents Windows 10 Macro to Split Documents Office 2016
Novice
Macro to Split Documents
 
Join Date: Sep 2019
Posts: 3
Gingerbreadgrl is on a distinguished road
Default

Hi Paul,

I posted on another one of the threads you responded to as well. I am trying to use a macro to split a document, on the other post it was by heading, on https://www.msofficeforums.com/word-...name-each.html is by header. I think header is a preferred option for me, but either one will do as long as it works. When I try the code you posted I receive the following error:

"Run time error 4605: this method or property is not available because the current selection is locked for editing."

When I hit debug it brings me to the following line of code:

.Range.PasteAndFormat (wdFormatOriginalFormatting)

The other macro you suggested (splitting by heading) didn't work either. Do you think this could be a bigger overall issue (like permissions) rather than an issue with the macro itself?

Thanks!
Gingergreadgrl

Last edited by macropod; 09-01-2019 at 10:26 PM. Reason: Split to new thread
Reply With Quote
  #3  
Old 09-01-2019, 10:21 PM
macropod's Avatar
macropod macropod is offline Macro to Split Documents Windows 7 64bit Macro to Split Documents Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 20,707
macropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant future
Default

You should be using:
.Range.FormattedText = Rng.FormattedText
not:
range.formattedtext = rng.formattedtext
Note especially the leading period.

PS: Kindly don't post questions about essentially the same issue in multiple threads.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #4  
Old 09-02-2019, 11:02 AM
Gingerbreadgrl Gingerbreadgrl is offline Macro to Split Documents Windows 10 Macro to Split Documents Office 2016
Novice
Macro to Split Documents
 
Join Date: Sep 2019
Posts: 3
Gingerbreadgrl is on a distinguished road
Default

Hi Paul,

Thanks for your reply. My apologies for posting in two places. However, the posts were about two different pieces of code. The code that I posted about here does not contain

.Range.FormattedText = Rng.FormattedText

However, I did check the other code (for the headings) and that was a user error when typing it in the message box. The actual code did contain the leading period and still produces an error.

So are you suggesting that within the SplitMergedDocument code that I replace the following:

.Range.PasteAndFormat (wdFormatOriginalFormatting)

with:

.Range.FormattedText = Rng.FormattedText

I tried that and it gave me an error at that code line.

Thanks!
Gingerbreadgrl
Reply With Quote
  #5  
Old 09-02-2019, 03:18 PM
macropod's Avatar
macropod macropod is offline Macro to Split Documents Windows 7 64bit Macro to Split Documents Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 20,707
macropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant future
Default

Your first post, relating to https://www.msofficeforums.com/word-...save-file.html, refers to code that uses:
.Range.FormattedText = Rng.FormattedText
Solving the problem will be much simpler if you stick with the code from one thread, rather than haring off in multiple directions. You can't simply copy a line of code from one routine and paste it into another without regard to the differences in how each routine works.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to Split Documents Mail Merge - split merged documents and rename each split document based on text in header FuriousD Word VBA 1 05-12-2019 04:06 AM
Using Split Macro - Need to keep first 7 rows CPSmith Excel Programming 1 02-09-2016 08:19 PM
Can I edit 2 documents in split screen? ivanabq Word 2 09-22-2015 04:28 PM
Help Please: New VBA user trying to use a macro to split Mail Merge documents. Two Run-Time Error zipit189 Word VBA 7 03-18-2015 01:13 PM
Macro to Split Documents Split file y Heading1, saves in My documents didijaba Word VBA 3 05-06-2014 05:35 AM

Other Forums: Access Forums - Senior Forums

All times are GMT -7. The time now is 08:17 AM.


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