#1
|
|||
|
|||
insert another document at the end
hi, i have a document, and at the end of this document, we want to insert another document from another location in the server directory (shared drive). the document i want to insert is a read only document and has different header than the main document. is there a macro which can do this task and insert this document (with different header) and we want to keep this header along with the new document. Regards |
#2
|
||||
|
||||
You could use code like:
Code:
Sub Demo() Dim Scn As Section, HdFt As HeaderFooter With ActiveDocument Set Scn = .Sections.Add(Range:=.Range.Characters.Last, Start:=wdSectionNewPage) With Scn For Each HdFt In Scn.Headers HdFt.LinkToPrevious = False .Range.Text = vbNullString Next For Each HdFt In Scn.Footers HdFt.LinkToPrevious = False .Range.Text = vbNullString Next .Range.InsertFile FileName:="Filepath & name" While .Range.Characters.Last.Previous = vbCr .Range.Characters.Last.Previous.Delete Wend End With End With End Sub PS: Please post macro-related Word questions in the Word VBA forum.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Thanks, I have tried the following two: it gives me filepath not correct message
.Range.InsertFile FileName:="\\psksvr\zeus_d\PSK SERVICE AGREEMENTS\Client Ongoing Service Agreement - Platinum.docx" and .Range.InsertFile FileName:="\\psksvr\zeus_d\PSK SERVICE AGREEMENTS & Client Ongoing Service Agreement - Platinum.docx" any idea why? |
#4
|
||||
|
||||
Try using the mapped file path, not the server's UNC path.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
||||
|
||||
What you get if you open the reference document and use:
Code:
Sub Test() MsgBox ActiveDocument.FullName End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#6
|
|||
|
|||
Hi Paul,
Thanks it works. Just wondering if we can make the word document to ask us about the "adviser name" and "client name". Also ask if it should use "i" or "we". At present this is sample of our ongoing advice agreement: Between Adviser name (an authorised representative of ) and Client name(s), dated 5 March 2012. Client acknowledgment · I/We agree that Adviser nameis to be my/our financial adviser on an ongoing basis to provide financial advice, the nature of which is described in the Financial Services Guide (FSG) and in this Client Service Agreement. |
#7
|
||||
|
||||
Maybe I missed something, but i can't see the connection between that and the rest of your post.
You can, of course use an InputBox to solicit information that you could then feed into a Find/Replace process, but you'll need to provide more detail about where these changes should be made. I don't suppose that every instance of 'Adviser name', 'Client name' or I/we is meant to be changed, or have the same change. The I/we change is probably the hardest, as it involves testing for whether I/we is at the start of a sentence and, quite possibly, there are other words that should be changed from singular to plural accordingly.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Insert multi page pdf into Word 2010 document | TimTDP | Word | 1 | 04-18-2012 04:22 AM |
How to Insert a Clear, Blank page without Lines and Numbers in a Pleading Document | Dirigo | Word | 5 | 09-30-2011 08:08 AM |
How to insert a .mov file in Word Document | Jai25 | Word | 0 | 02-11-2010 04:40 PM |
How to Insert Multi Indexses in a document??? | Bahir Barak | Word | 1 | 01-05-2010 04:30 AM |
How Can you insert a live hosted picture- in a document? -How can it be done?-Help!! | nationsheet | Word | 0 | 05-15-2009 06:53 PM |