![]() |
#1
|
|||
|
|||
![]()
I am not the most versed in VBA so needed some help. I have this function but I am not sure how to pass the current document as the input.
Here is the beggining of the procedure, please advise how i reference the current document as the "Sentences" to use as the input to this function.. Code:
Function GetSentences(ByVal Sentences As String) As Collection 'Delete space Sentences = Trim(Sentences) Dim sList As New Collection Dim RE As Object, REMatches As Object Set RE = CreateObject("vbscript.regexp") With RE .MultiLine = False .Global = True .IgnoreCase = False .Pattern = "(\S.+?[.?])(?=\s+|$)\s" End With .... End Function |
#2
|
||||
|
||||
![]()
What you'd pass to that function is not the document, but its content, as in:
GetSentences (ActiveDocument.Range.Text) Instead of ActiveDocument, you might specify a particular document; you might also specify a particular range from that document rather than all of it.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
megatronixs | Word VBA | 9 | 09-05-2020 02:29 PM |
![]() |
tinfanide | PowerPoint | 4 | 12-28-2012 06:14 PM |
How to pass parameters to a .msg file? | HereNow | Outlook | 0 | 11-05-2012 10:38 AM |
Office 2010 Excel Full pass | raineraus | Excel | 1 | 09-19-2012 12:55 PM |
![]() |
h3rk | Word Tables | 1 | 11-20-2009 07:34 AM |