Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-06-2012, 06:45 PM
ubns ubns is offline insert another document at the end Windows 7 32bit insert another document at the end Office 2010 32bit
Competent Performer
insert another document at the end
 
Join Date: Apr 2012
Posts: 177
ubns is on a distinguished road
Default 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
Reply With Quote
  #2  
Old 05-06-2012, 10:29 PM
macropod's Avatar
macropod macropod is offline insert another document at the end Windows 7 64bit insert another document at the end 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

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
Of course, you'll need to change 'Filepath & name' to match your requirements.

PS: Please post macro-related Word questions in the Word VBA forum.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 05-06-2012, 10:55 PM
ubns ubns is offline insert another document at the end Windows 7 32bit insert another document at the end Office 2010 32bit
Competent Performer
insert another document at the end
 
Join Date: Apr 2012
Posts: 177
ubns is on a distinguished road
Default

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?
Reply With Quote
  #4  
Old 05-06-2012, 11:11 PM
macropod's Avatar
macropod macropod is offline insert another document at the end Windows 7 64bit insert another document at the end 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

Try using the mapped file path, not the server's UNC path.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 05-06-2012, 11:13 PM
macropod's Avatar
macropod macropod is offline insert another document at the end Windows 7 64bit insert another document at the end 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

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]
Reply With Quote
  #6  
Old 05-06-2012, 11:26 PM
ubns ubns is offline insert another document at the end Windows 7 32bit insert another document at the end Office 2010 32bit
Competent Performer
insert another document at the end
 
Join Date: Apr 2012
Posts: 177
ubns is on a distinguished road
Default

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.
Reply With Quote
  #7  
Old 05-06-2012, 11:37 PM
macropod's Avatar
macropod macropod is offline insert another document at the end Windows 7 64bit insert another document at the end 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

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]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
insert another document at the end 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
insert another document at the end 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

Other Forums: Access Forums

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