#1
|
|||
|
|||
Code for storing new word
Hi...
I'm learning new language and i want to store all my vocabularies in word office... I need macro code that works like this : 1. first i copy a word from my ebook or other source, then by running a macro in my word office, it will search whether the coppied word has existed or not. 2. if existed, then highlight the word 3. if not existed then create new line after the lowermost word and paste the word. I know how to do it by using keyboard shortcut, but it need more than one step and it cannot use conditional statement. Thank |
#2
|
||||
|
||||
You could use a macro like:
Code:
Sub Demo() Application.ScreenUpdating = False Dim StrFnd As String StrFnd = Trim(InputBox("Please input the word to find.")) If StrFnd = "" Then Exit Sub With ActiveDocument.Range With .Find .ClearFormatting .Replacement.ClearFormatting .Text = StrFnd .Replacement.Text = "^&" .Format = True .Forward = True .Wrap = wdFindContinue .MatchCase = False .MatchWholeWord = True .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False .Execute End With If .Find.Found = True Then .Select '.HighlightColorIndex = wdYellow Else .InsertAfter vbCr & StrFnd End If End With Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Hi macropod,
This is what i'm looking for and Thank for your great helping... this is working really well. Thank you so much for answering... |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Code to select the previous word | capitala | PowerPoint | 1 | 12-11-2014 08:53 AM |
Software that removes Word code | ep2002 | Word | 6 | 10-10-2014 07:35 PM |
PowerPoint storing colors as system color names ?!?! | Malcom | PowerPoint | 0 | 08-24-2013 01:12 AM |
Add Google anylitics code to Word Doc | Hexasphere | Word | 5 | 06-06-2011 02:15 AM |
Styling 'code' in word | scottyearl | Word | 0 | 03-08-2009 09:18 AM |