Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 11-27-2023, 07:32 PM
knpaddac knpaddac is offline Merging word documents containing tables Windows 10 Merging word documents containing tables Office 2016
Novice
Merging word documents containing tables
 
Join Date: Jan 2018
Posts: 13
knpaddac is on a distinguished road
Default

This does pull all the content in BUT it does not put the filenames in the resulting document like the previous version did.


Quote:
Originally Posted by Guessed View Post
Try this version
Code:
Sub Import_Text()
  Dim strFolder As String, strFile As String, wdDoc As Document
  Application.ScreenUpdating = False
  strFolder = GetFolder
  If strFolder = "" Then Exit Sub
  strFile = Dir(strFolder & "\*.rtf", vbNormal)
  ChangeFileOpenDirectory strFolder
  Set wdDoc = ActiveDocument
  
  While strFile <> ""
    wdDoc.Range.Paragraphs.Last.Range.InsertFile FileName:=strFolder & "\" & strFile, ConfirmConversions:=False, Link:=False, Attachment:=False
    strFile = Dir()
  Wend
  Set wdDoc = Nothing
  Application.ScreenUpdating = True
End Sub
 
Function GetFolder() As String
  Dim oFolder As Object
  Set oFolder = CreateObject("Shell.Application").BrowseForFolder(0, "Choose a folder", 0)
  If (Not oFolder Is Nothing) Then GetFolder = oFolder.Items.Item.Path
  Set oFolder = Nothing
End Function
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Merging word documents containing tables Merging Word documents kp4bnx Word VBA 4 03-10-2021 02:49 PM
Merging word documents containing tables Batch merging of Word documents Harry Gateaux Word VBA 6 11-19-2020 09:58 AM
Merging word documents containing tables Updating links while merging Word documents ndw Word VBA 1 11-10-2017 01:07 PM
Merging word documents containing tables Merging two tables in WORD with VBA ffinley Word VBA 3 03-14-2017 07:43 PM
Merging different documents in one big document keeping the chapters, figure numbers and tables village Word 8 06-06-2016 04:16 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:41 PM.


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