Wrox Programmer Forums

Need to download code?

View our list of code downloads.

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

You are currently viewing the Word 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
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 30th, 2007, 04:50 PM
Authorized User
 
Join Date: Apr 2004
Location: , , .
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to copy text in a word file on the clipboard

I need to know how I can use VBA to select a word file and extract the body of that file to place it on the clipboard. The reason for this is I have an MS Access database which I am creating an automated email function with VBA. I want to use VBA to select a word file or word template with autotext and grab all the text within the body of the word file and place it in the body of the email...then with VBA send the email without user involvement. Does anyone have a code example for this? thanks in advanced.

donrafeal

Reply With Quote
  #2 (permalink)  
Old January 31st, 2007, 12:59 AM
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: , , .
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default


Activedocument.Content.Copy

will copy the contents of the active (current) document.

you can use appropriate object like Documents(1) etc

Cheers
Shasur


http://www.vbadud.blogspot.com
Reply With Quote
  #3 (permalink)  
Old January 31st, 2007, 11:22 AM
Authorized User
 
Join Date: Apr 2004
Location: , , .
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks for the help with that. Is there a way to copy the content of a file that is not open?

Reply With Quote
  #4 (permalink)  
Old February 1st, 2007, 12:32 AM
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: , , .
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

You can open the word document thru code and then close it

Set oWD = Word.documents.open("c:\sample.doc")

oWD.Content.Copy

' Do the pasting operations

oWD.close SaveChanges:=False

Hope this works out

If you do not want to open Word etc, I think, you can try out reading the file in binary more and transferring the contents

Cheers
Shasur


http://www.vbadud.blogspot.com
Reply With Quote
Reply


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
Drop Changes or Copy to clipboard JezLisle Access VBA 4 November 20th, 2008 10:24 AM
Copy Metafile to the Clipboard TMA_Master BOOK: Visual Basic 2008 Programmer's Reference ISBN: 978-0-470-18262-8 1 August 26th, 2008 10:59 PM
Copy text to win Clipboard irresistible007 Beginning VB 6 6 October 5th, 2006 06:04 AM
Copy to Clipboard Clive Astley Access 5 July 16th, 2004 07:16 PM
convert Word file to jpg w/o using clipboard lam_bon_bon VB How-To 0 September 13th, 2003 05:27 AM



All times are GMT -4. The time now is 12:52 PM.


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