![]() |
|
|
|
#1
|
||||
|
||||
|
How about: Code:
Sub GetMaxSpaces()
Dim StrTxt As String, StrTmp As String, i As Long
StrTxt = ActiveDocument.Range.Text: StrTmp = " "
While InStr(StrTxt, StrTmp) > 0
StrTmp = StrTmp & " "
i = i + 1
Wend
MsgBox "The maximum space sequence is: " & i
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#2
|
|||
|
|||
|
Much faster
.Find, simply is the wrong approach. You made my (Sun)day. Thx NP |
|
#3
|
|||
|
|||
|
Quote:
How can I ensure that only blanks are counted for text in "myCount" style within you super fast code. Maybe it's just too early for programming and my brain is still in sleep mode ... Thanks again NP |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Help!! find two number recurring numbers in row??
|
carrolld2 | Excel | 5 | 06-28-2014 05:43 PM |
macro to find a character and insert space so autocorrect will expand
|
redzan | Word VBA | 3 | 05-22-2014 04:22 PM |
Help with the "find and replace" option; character problem
|
martinn4 | Word | 3 | 02-20-2014 03:52 AM |
Conditional tied to trying to find a " " space character
|
Dart82 | Word VBA | 3 | 10-04-2013 01:47 PM |
| Concatenated data in subsequent rows | doorsgirl | Excel | 4 | 09-15-2011 10:37 PM |