Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-04-2014, 06:39 PM
Iluvatar343 Iluvatar343 is offline Copying Selected Text Between Word Documents Windows 7 64bit Copying Selected Text Between Word Documents Office 2010 64bit
Novice
Copying Selected Text Between Word Documents
 
Join Date: Jun 2014
Posts: 1
Iluvatar343 is on a distinguished road
Default Copying Selected Text Between Word Documents


Hello all. I'm relatively new to VBA, so forgive me if the answer to this is obvious.

I'm working on organizing a series of trivia questions based on their category (ie Science, History, etc). I have word documents that contain ~50 questions each, and then several other word documents where I have been compiling the questions to date. What I'm trying to create is a macro that will copy highlighted text to the appropriate document based on a certain key press. For instance, if I came across a literature question, I'd like to be able to highlight the text (or have it detect the length of the question and select it for me, though I think I can do that) and press Ctrl+Shift+L to move it into the correct document, or do the same by pressing Ctrl+Shift+S for a science question.

Thanks in advance for your help.
Reply With Quote
  #2  
Old 06-05-2014, 05:15 AM
jpb103's Avatar
jpb103 jpb103 is offline Copying Selected Text Between Word Documents Windows 7 64bit Copying Selected Text Between Word Documents Office 2007
Advanced Beginner
 
Join Date: May 2014
Location: Thunder Bay, Ontario
Posts: 58
jpb103 is on a distinguished road
Default

Something like this might help to get you started:
Code:
Sub MovetoLit()
    Selection.Copy
    ChangeFileOpenDirectory "\\path\"
    Documents.Open FileName:= _
        "\\path\filename.docx", _
        ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False, _
        PasswordDocument:="", PasswordTemplate:="", Revert:=False, _
        WritePasswordDocument:="", WritePasswordTemplate:="", Format:= _
        wdOpenFormatAuto, XMLTransform:=""
        Selection.PasteAndFormat (wdPasteDefault)
End Sub
And just assign it to Ctrl+Shift+L when you create it. Do pretty much the same thing with the other macros (all you really need to change is the name of the macro, the key-binding and the path/filename for each category). Hope that helps!
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying text from Word 2010 into Outlook Keith Outlook 0 11-25-2011 02:30 PM
Mac Word - replace within selected text only. bakerbj Word 0 10-31-2011 11:47 PM
Importing Selected Text Into Word Document Mooseman60 Word 1 10-06-2011 03:18 AM
Copying Selected Text Between Word Documents Copying text from Excel to Word Fossils13 Office 1 02-22-2010 08:39 PM
Copying tables between Word documents best practices? dylane Word Tables 0 12-18-2008 12:21 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:46 PM.


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