Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-27-2022, 07:31 AM
speckledegg speckledegg is offline Problem merging to separate docs Windows 10 Problem merging to separate docs Office 2019
Novice
Problem merging to separate docs
 
Join Date: Apr 2022
Posts: 3
speckledegg is on a distinguished road
Default Problem merging to separate docs

I'm having the same problem as described in https://www.msofficeforums.com/mail-...rate-docs.html, but I've narrowed it down to Runtime Error '5852' Requested object is not available - it seems to be linked to .Destination = wdSendToNewDocument



I don't know anything about coding - I just needed a macro so I can split merged documents into separate files so I too would love to know how to fix this.

Last edited by macropod; 04-28-2022 at 03:10 PM. Reason: Split to new thread
Reply With Quote
  #2  
Old 04-27-2022, 03:09 PM
macropod's Avatar
macropod macropod is offline Problem merging to separate docs Windows 10 Problem merging to separate docs Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

Quote:
Originally Posted by speckledegg View Post
I'm having the same problem, but I've narrowed it down to Runtime Error '5852' Requested object is not available - it seems to be linked to .Destination = wdSendToNewDocument
That line is just standard Word VBA. Are you running this from Word?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 04-27-2022, 04:33 PM
speckledegg speckledegg is offline Problem merging to separate docs Windows 10 Problem merging to separate docs Office 2019
Novice
Problem merging to separate docs
 
Join Date: Apr 2022
Posts: 3
speckledegg is on a distinguished road
Default

Yes; I tried running it with and without the renaming. If I run it from Word with the renaming, then nothing happens after you select "Edit Individual Documents" - it just appears to do nothing.

If I keep the original name (as per your original code) and run the macro on the mailmerged document, I get the runtime error.

For this whole exercise, I am using an Excel spreadsheet as the source, and mailmerging a Word document (using the spreadsheet to populate fields in a letter).

I hope that makes sense.
Reply With Quote
  #4  
Old 04-28-2022, 07:11 AM
macropod's Avatar
macropod macropod is offline Problem merging to separate docs Windows 10 Problem merging to separate docs Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

Quote:
Originally Posted by speckledegg View Post
Yes; I tried running it with and without the renaming. If I run it from Word with the renaming, then nothing happens after you select "Edit Individual Documents" - it just appears to do nothing.
That is to be expected.
Quote:
Originally Posted by speckledegg View Post
If I keep the original name (as per your original code) and run the macro on the mailmerged document, I get the runtime error.
One apparent error in your code concerns:
Code:
        'StrFolder = .DataFields("Folder") & "\"
        StrName = .DataFields("Folder_Name") & "_" & .DataFields("Last_Name")
which should be:
Code:
        StrFolder = .DataFields(Folder_Name") & "\"
        StrName = .DataFields("Last_Name")
To see why, look at the .SaveAs line...

Apart from that, there is no obvious reason why the runtime error would have anything to do with:
Code:
.Destination = wdSendToNewDocument
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 04-28-2022, 10:15 AM
speckledegg speckledegg is offline Problem merging to separate docs Windows 10 Problem merging to separate docs Office 2019
Novice
Problem merging to separate docs
 
Join Date: Apr 2022
Posts: 3
speckledegg is on a distinguished road
Default

Thanks for the continued help;

This has helped me a lot actually, as I believe that Note 3 in the original guide may not have been followed correctly (at least in my code, I can't say for the OP's).

One of the things I was trying to do was use a text and field combination for the filenames, and I couldn't get that to work. I've now just added the field for filename in the data source and that seems to work fine.

Thank you!
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem merging to separate docs Merge into Separate Docs chrnon Mail Merge 1 04-27-2022 03:08 PM
Merging of colums from two different docs & create a new doc ranjan Word VBA 9 08-31-2021 08:25 AM
Problem merging to separate docs Extra blank page at end of each document when merging to separate documents. Blondyvl Mail Merge 1 12-03-2020 04:33 PM
Problem merging to separate docs Merging Various .docs Via Q&A Wants_It_Simple Word 1 06-30-2014 10:26 PM
Problem merging to separate docs Adding identical footers to 187 separate docs sqzdog Word 11 10-31-2011 01:46 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:56 PM.


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