A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Office » General Discussions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Merging Multiple documents having different headers and footers ma



 
 
Thread Tools Display Modes
  #1  
Old December 9th, 2009, 09:07 AM posted to microsoft.public.office.misc
srikanth
external usenet poster
 
Posts: 54
Default Merging Multiple documents having different headers and footers ma

Dear All,

I am trying to merge a several word/rtf documents into a single word
documents with the below macro, the problem is now each document is having a
different header and footer and some fields,
Can anyone suggest me a macro code for merging multiple word documents into
a single document without disturbing the headers and footers of each document?

Sub MergeDocs()
Dim rng As Range
Dim MainDoc As Document
Dim strFile As String
Const strFolder = "c:\tes\" 'change to suit
Set MainDoc = Documents.Add
strFile = Dir$(strFolder & "*.doc") ' can change to .docx
Do Until strFile = ""
Set rng = MainDoc.Range
rng.Collapse wdCollapseEnd
rng.InsertFile strFolder & strFile
strFile = Dir$()
Loop
End Sub

Thanks in advance.
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:46 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.