Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-10-2023, 03:09 PM
maw444 maw444 is offline Merge two documents using VBA Windows 10 Merge two documents using VBA Office 2019
Advanced Beginner
Merge two documents using VBA
 
Join Date: Feb 2021
Posts: 35
maw444 is on a distinguished road
Default Merge two documents using VBA

I would like to import the text from another word document into the current word document



Could someone help me with the code
Reply With Quote
  #2  
Old 06-12-2023, 04:26 PM
Guessed's Avatar
Guessed Guessed is offline Merge two documents using VBA Windows 10 Merge two documents using VBA Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,977
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Something list this would work
Code:
Selection.InsertFile FileName:="C:\Folder\WordInput.docx", Range:="", _
    ConfirmConversions:=False, Link:=False, Attachment:=False
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #3  
Old 06-12-2023, 11:08 PM
maw444 maw444 is offline Merge two documents using VBA Windows 10 Merge two documents using VBA Office 2019
Advanced Beginner
Merge two documents using VBA
 
Join Date: Feb 2021
Posts: 35
maw444 is on a distinguished road
Default

Quote:
Originally Posted by Guessed View Post
Something list this would work
Code:
Selection.InsertFile FileName:="C:\Folder\WordInput.docx", Range:="", _
    ConfirmConversions:=False, Link:=False, Attachment:=False
Thank you. How do I change the file reference so it always looks in the same directory as the base document in which the code sits
Reply With Quote
  #4  
Old 06-13-2023, 02:11 PM
Guessed's Avatar
Guessed Guessed is offline Merge two documents using VBA Windows 10 Merge two documents using VBA Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,977
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

The path to the current document would be
ActiveDocument.Path

so you could modify the code to
Code:
Selection.InsertFile FileName:=ActiveDocument.Path & "\WordInput.docx", Range:="", _
    ConfirmConversions:=False, Link:=False, Attachment:=False
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
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
merge two documents alternatively digiman Word 9 09-09-2020 01:00 PM
Merge two documents using VBA Merge documents coriolisss Word VBA 3 11-16-2018 03:14 PM
Merge two documents using VBA Merge to Seperate Documents joughin Mail Merge 1 05-17-2012 05:08 PM
Merge two documents using VBA 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 12:51 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