Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 4th, 2003, 05:41 AM
Registered User
Join Date: Dec 2003
Location: , , India.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Copying some part of the doc using macro in word


i want to copy some part(means the content between two words namely "word1" AND "word2" in the document )of the word document and to place in other word document using a macro.

Can any body know the code for the macro.
Reply With Quote
  #2 (permalink)  
Old December 4th, 2003, 04:04 PM
Friend of Wrox
Join Date: Oct 2003
Location: , , Finland.
Posts: 168
Thanks: 0
Thanked 0 Times in 0 Posts

Try this code

Sub SelectRange()
Dim lCharpos1 As Long
Dim lCharpos2 As Long


    Selection.Find.Execute "word1"
    lCharpos1 = Selection.Range.Start

    Selection.Find.Execute "word2"

    lCharpos2 = Selection.Range.End

    ActiveDocument.Range(Start:=lCharpos1, End:=lCharpos2).Select

End Sub

Reply With Quote
  #3 (permalink)  
Old December 5th, 2003, 05:36 AM
Registered User
Join Date: Dec 2003
Location: , , India.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts

thanks a lot.

it's working.

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating word doc - word behaviour mat41 Classic ASP Professional 2 April 29th, 2007 06:46 PM
Copying part of a record FierceDeity Access 2 April 3rd, 2007 05:45 PM
Copy text from 1 doc to other doc thru vba in word itchock Word VBA 2 December 29th, 2006 02:47 AM
Word 2000 VBA AutoCorrect copying rjohnson VB How-To 0 August 30th, 2004 12:40 PM
Copy word to word doc. in VB vamshi Pro VB 6 1 March 24th, 2004 06:25 PM

All times are GMT -4. The time now is 01:14 PM.

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