Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 12th, 2004, 12:16 AM
Registered User
Join Date: Mar 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Copy word to word doc. in VB


Can u help me please...

I have a doubt in VB.

I need to copy an object(b/w a start label and an end label) from an existing word document to a new word document. All this should be done in VB. (invoked from VB)

It works fine when both the start and end labels are present in the same page of the word. But fails when the end label is present on a different page.

It's really urgent. Can u please give me the code for the above problem?


Old March 24th, 2004, 06:25 PM
Authorized User
Join Date: Jul 2003
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts


Here is a code to add all documents from the listbox lsDocuments:

Dim m_OWordDoc As Word.Document

For intI = 1 To lsDocuments.ListItems.Count
                 m_OWordDoc.Application.Selection.InsertFile fileName:=lsDocuments.ListItems(intI).Text
         m_OWordDoc.Application.Selection.InsertParagraph After
     m_OWordDoc.Application.Selection.EndKey unit:=wdStory


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i get vb printer.print code for a word doc choudhry.usman Word VBA 1 March 6th, 2008 10:46 PM
Creating word doc - word behaviour mat41 Classic ASP Professional 2 April 29th, 2007 06:46 PM
Copy text from 1 doc to other doc thru vba in word itchock Word VBA 2 December 29th, 2006 02:47 AM
Copy contents of Word doc & Paste in Excel - How?? robear Javascript How-To 1 August 23rd, 2006 03:22 PM
How to Copy contents of Word doc & Paste in Excel robear Pro PHP 0 August 21st, 2006 12:25 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.