![]() |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
||||
|
||||
|
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
|
|
|
|
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 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 |