Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.
' Excel 2002 Code ' -------------------- Dim oWord As Object Dim oWordDocument As Object Dim oSelection As Object Set oWord = CreateObject("Word.application") oWord.Visible = True Set oWordDocument = oWord.documents.Add Set oSelection = oWord.Selection oSelection.typetext Trim(Cells(Selection.Row, iColumnToLimitWords).Value) oSelection.WholeStory ' loop counting the words and then deleting one word at a time until the limit is reached Do While oWord.ActiveDocument.Range.ComputeStatistics(0) >= iNumberOfWordsAllowed oSelection.WholeStory oSelection.Range.Words.last.Delete ' THIS LINE SEEMS TO DO NOTHING Loop oWordDocument.Selection.WholeStory oWordDocument.Selection.Copy Cells(Selection.Row, iColumnToLimitWords).Value = ActiveWorkbook.Paste
|Complex Lookup Formulas||3||30|
|Word - Access||5||23|
|VBA Object does not support property or method||3||19|
|Function or formula to identify the last repeated character in a cell in Excell||9||0|
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
16 Experts available now in Live!