#1
|
|||
|
|||
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 |
#2
|
|||
|
|||
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 |
#3
|
||||
|
||||
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] |
#4
|
|||
|
|||
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 |
#5
|
||||
|
||||
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] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
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 |
Split file y Heading1, saves in My documents | didijaba | Word VBA | 3 | 05-06-2014 05:35 AM |