need help adding to macro below 
Author Message
 need help adding to macro below

Dave Lett and Klause Linke helped with this macro. It searched thru a
document and copies words in all caps and words in parenthesis to another
document. I am using it to extract and locate accronyms. I am wondering 2
things: Where can I insert or better yet how can I insert a tab and page
number where the accronym is. I was also wondering about another code that
will search thru an entire folder and do the same thing.

Thanks

Jerry

Sub AcronExtract()

Dim sAbbr As String
Dim sText As String
With Selection
    .HomeKey Unit:=wdStory
    With .Find
        .Text = "\(*\)"
        .MatchWildcards = True
        .ClearFormatting
        Do While .Execute
            sAbbr = sAbbr & Selection.Text & vbCrLf
        Loop
    End With
End With

With Selection
    .HomeKey Unit:=wdStory
    With .Find
        .Text = "<[A-Z0-9]{3,}>"
        .MatchWildcards = True
        .ClearFormatting
        Do While .Execute
            sText = sText & Selection.Text & vbCrLf
        Loop
    End With
    .HomeKey Unit:=wdStory
End With

Documents.Add
ActiveDocument.Range.InsertAfter sAbbr & vbCrLf & sText

End Sub



Wed, 06 Jul 2005 00:30:19 GMT  
 need help adding to macro below

Hi Jerry,

I think you only need to change two lines:

sAbbr = sAbbr & Selection.Text & vbTab & _
    Selection.Information(wdActiveEndAdjustedPageNumber) & vbCrLf

sText = sText & Selection.Text & vbTab & _
    Selection.Information(wdActiveEndAdjustedPageNumber) & vbCrLf

You might want to take a look at the VBA help file topic "Information
Property" and compare the differences of wdActiveEndAdjustedPageNumber and
wdActiveEndPageNumber.

HTH


Quote:
> Dave Lett and Klause Linke helped with this macro. It searched thru a
> document and copies words in all caps and words in parenthesis to another
> document. I am using it to extract and locate accronyms. I am wondering 2
> things: Where can I insert or better yet how can I insert a tab and page
> number where the accronym is. I was also wondering about another code that
> will search thru an entire folder and do the same thing.

> Thanks

> Jerry

> Sub AcronExtract()

> Dim sAbbr As String
> Dim sText As String
> With Selection
>     .HomeKey Unit:=wdStory
>     With .Find
>         .Text = "\(*\)"
>         .MatchWildcards = True
>         .ClearFormatting
>         Do While .Execute
>             sAbbr = sAbbr & Selection.Text & vbCrLf
>         Loop
>     End With
> End With

> With Selection
>     .HomeKey Unit:=wdStory
>     With .Find
>         .Text = "<[A-Z0-9]{3,}>"
>         .MatchWildcards = True
>         .ClearFormatting
>         Do While .Execute
>             sText = sText & Selection.Text & vbCrLf
>         Loop
>     End With
>     .HomeKey Unit:=wdStory
> End With

> Documents.Add
> ActiveDocument.Range.InsertAfter sAbbr & vbCrLf & sText

> End Sub



Wed, 06 Jul 2005 01:23:34 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. help with macro below

2. I need vc ide macro help, trying to create a move to end of word macro

3. macro or module to add a record to a table needed

4. Can anyone help me with adding a bit onto a macro that i have

5. Help! Adding mass projects through macro

6. Help Needed - Passing Value from Access 97 to Word 97 Macro

7. URGENT--Need help starting excel macro from access

8. desperately need help with RunCode in a macro

9. Need Help with Macro Substitution/Indirect Addressing

10. Help with modules, macros, VBA needed

11. Help needed with Outlook macro

12. Need Help - Macro Won't Close Document

 

 
Powered by phpBB® Forum Software