Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-13-2018, 04:19 AM
coriolisss coriolisss is offline Merge documents Windows 10 Merge documents Office 2013
Novice
Merge documents
 
Join Date: Nov 2018
Posts: 2
coriolisss is on a distinguished road
Default Merge documents

Hello,

I am a very bigninner in Word VBA.


I would like to code something to help me merge multiple Word documents in one only Word file, with the "MergeDocuments".
But "Mergedocuments" doesn't work for me :

Code:
    Application.MergeDocuments OriginalDocument:=Documents("Part1A.docx"), _
        RevisedDocument:=Documents("Part2.docx"), Destination:= _
        wdCompareDestinationNew, Granularity:=wdGranularityWordLevel, _
        CompareFormatting:=True, CompareCaseChanges:=True, CompareWhitespace:= _
        True, CompareTables:=True, CompareHeaders:=True, CompareFootnotes:=True, _
        CompareTextboxes:=True, CompareFields:=True, CompareComments:=True, _
        CompareMoves:=True, OriginalAuthor:="GD", RevisedAuthor:= _
        "GD", FormatFrom:=wdMergeFormatFromPrompt
I have got the 4160 error.

Could you help me please ?
Thanks
Reply With Quote
  #2  
Old 11-13-2018, 01:37 PM
macropod's Avatar
macropod macropod is offline Merge documents Windows 7 64bit Merge documents 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

The 4160 error message includes a sentence telling you you've supplied a bad filename. That's because you need to supply the full path, as well, for both files.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 11-16-2018, 03:10 PM
coriolisss coriolisss is offline Merge documents Windows 10 Merge documents Office 2013
Novice
Merge documents
 
Join Date: Nov 2018
Posts: 2
coriolisss is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
The 4160 error message includes a sentence telling you you've supplied a bad filename. That's because you need to supply the full path, as well, for both files.
I just understand the problem: the 2 files need to be open first. So I added this in the code and it works fine.
Thank you for your help.
Reply With Quote
  #4  
Old 11-16-2018, 03:14 PM
macropod's Avatar
macropod macropod is offline Merge documents Windows 7 64bit Merge documents 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

Quote:
Originally Posted by coriolisss View Post
I just understand the problem: the 2 files need to open first.
Not so. As I already said, you need to supply the full path, not just the filename.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
100 Primary Mail Merge Documents - want to add a table with fields to all of the primary documents revans611 Mail Merge 3 09-15-2020 12:07 PM
How to merge track changes from 2 documents jbz Word 1 09-18-2015 01:30 PM
Merge documents Merge info into 5 separate documents kenjmaraty Word 3 07-06-2015 07:30 AM
Merge documents Merge to Seperate Documents joughin Mail Merge 1 05-17-2012 05:08 PM
Merge documents Merge documents ilce Mail Merge 1 02-16-2012 02:33 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:00 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