Getting beyond max. string size in specific VBA codeGetting around the Max String size in a vba function?Getting around the Max String size in a vba function?How to Pretty print VBA code?VBA code to get hidden fieldsTo infinity and beyond in VBAHow to comment and uncomment blocks of code in the Office VBA EditorExcel VBA code to copy a specific string to clipboardvba string max sizeVBA code is getting error 462VBA changing font size of one character in specific string (MSWORD MACRO)VBA code stops after Documents.Open
Would denouncing cheaters from an exam make me less likely to receive penalties?
How do you correct inclination at launch to ISS?
Deck of Cards with Shuffle and Sort functionality
Why does Trump want a citizenship question on the census?
As a supervisor, what feedback would you expect from a PhD who quits?
Separate a column into its components based on another table
How can I know how much authority/decision making power etc I have as an employee?
Gaining Proficiency in Vehicles (water)
Other Space Shuttle O-ring failures
Category-theoretic treatment of diffs, patches and merging?
How to evaluate the performance of open source solver?
What was the significance of Spider-Man: Far From Home being an MCU Phase 3 film instead of a Phase 4 film?
What kind of Chinook helicopter/airplane hybrid is this?
How can I use my cell phone's light as a reading light?
How do I separate enchants from items?
QR codes, do people use them?
Sense of humor in your sci-fi stories
Tesco's Burger Relish Best Before End date number
Passwordless authentication - how and when to invalidate a login code
Blocks from @ jafe
Is it possible to complete a PhD in CS in 3 years?
My professor has told me he will be the corresponding author. Will it hurt my future career?
Array or vector? Two dimensional array or matrix?
Why am I getting unevenly-spread results when using $RANDOM?
Getting beyond max. string size in specific VBA code
Getting around the Max String size in a vba function?Getting around the Max String size in a vba function?How to Pretty print VBA code?VBA code to get hidden fieldsTo infinity and beyond in VBAHow to comment and uncomment blocks of code in the Office VBA EditorExcel VBA code to copy a specific string to clipboardvba string max sizeVBA code is getting error 462VBA changing font size of one character in specific string (MSWORD MACRO)VBA code stops after Documents.Open
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am an English teacher trying to familiarize myself with VBA. I have the following code below to underline certain words within a text, but I'm having problems with the max. string size of 255.
I want to increase the string size to add more words in a single string (700 to be more precise).
I found this item Getting around the Max String size in a vba function?, but I don't know how to implement that within my code.
Sub ListChange()
Dim r As Range
Dim MyList() As String
Dim i As Long
MyList = Split("segregation,investigation,treaty,accommodate,inheritance,tentative,utter,hijack,redundant,disrupt,conserve,lawsuit,graduate,handle,resolution,bewildered,fuss,confident,disguise,considerable,persistent,obligatory,expenses,initially,lecture,reluctance,extinct,toxic,precede,demolition,turnup,gap,disturb,independent,nerve,jusitification,turnout,compulsory,gathering,merciless,HomeOffice,impress,decline,diminish,essentially,deceive,advance,ambiguous,disposeof,disdain,apt,effort,famine,entirely,familiar,elderly,solution,commute,disproportionally,urge,obedience,retreat,merely,relief,distraction,principal,sanity,distortion,figure", ",")
For i = 0 To UBound(MyList())
Set r = ActiveDocument.Range
With r.Find
.Text = MyList(i)
.Replacement.Font.Underline = wdUnderlineSingle
.Execute Replace:=wdReplaceAll
End With
Next
End Sub
I want to get more characters in one string.
vba ms-word
add a comment |
I am an English teacher trying to familiarize myself with VBA. I have the following code below to underline certain words within a text, but I'm having problems with the max. string size of 255.
I want to increase the string size to add more words in a single string (700 to be more precise).
I found this item Getting around the Max String size in a vba function?, but I don't know how to implement that within my code.
Sub ListChange()
Dim r As Range
Dim MyList() As String
Dim i As Long
MyList = Split("segregation,investigation,treaty,accommodate,inheritance,tentative,utter,hijack,redundant,disrupt,conserve,lawsuit,graduate,handle,resolution,bewildered,fuss,confident,disguise,considerable,persistent,obligatory,expenses,initially,lecture,reluctance,extinct,toxic,precede,demolition,turnup,gap,disturb,independent,nerve,jusitification,turnout,compulsory,gathering,merciless,HomeOffice,impress,decline,diminish,essentially,deceive,advance,ambiguous,disposeof,disdain,apt,effort,famine,entirely,familiar,elderly,solution,commute,disproportionally,urge,obedience,retreat,merely,relief,distraction,principal,sanity,distortion,figure", ",")
For i = 0 To UBound(MyList())
Set r = ActiveDocument.Range
With r.Find
.Text = MyList(i)
.Replacement.Font.Underline = wdUnderlineSingle
.Execute Replace:=wdReplaceAll
End With
Next
End Sub
I want to get more characters in one string.
vba ms-word
add a comment |
I am an English teacher trying to familiarize myself with VBA. I have the following code below to underline certain words within a text, but I'm having problems with the max. string size of 255.
I want to increase the string size to add more words in a single string (700 to be more precise).
I found this item Getting around the Max String size in a vba function?, but I don't know how to implement that within my code.
Sub ListChange()
Dim r As Range
Dim MyList() As String
Dim i As Long
MyList = Split("segregation,investigation,treaty,accommodate,inheritance,tentative,utter,hijack,redundant,disrupt,conserve,lawsuit,graduate,handle,resolution,bewildered,fuss,confident,disguise,considerable,persistent,obligatory,expenses,initially,lecture,reluctance,extinct,toxic,precede,demolition,turnup,gap,disturb,independent,nerve,jusitification,turnout,compulsory,gathering,merciless,HomeOffice,impress,decline,diminish,essentially,deceive,advance,ambiguous,disposeof,disdain,apt,effort,famine,entirely,familiar,elderly,solution,commute,disproportionally,urge,obedience,retreat,merely,relief,distraction,principal,sanity,distortion,figure", ",")
For i = 0 To UBound(MyList())
Set r = ActiveDocument.Range
With r.Find
.Text = MyList(i)
.Replacement.Font.Underline = wdUnderlineSingle
.Execute Replace:=wdReplaceAll
End With
Next
End Sub
I want to get more characters in one string.
vba ms-word
I am an English teacher trying to familiarize myself with VBA. I have the following code below to underline certain words within a text, but I'm having problems with the max. string size of 255.
I want to increase the string size to add more words in a single string (700 to be more precise).
I found this item Getting around the Max String size in a vba function?, but I don't know how to implement that within my code.
Sub ListChange()
Dim r As Range
Dim MyList() As String
Dim i As Long
MyList = Split("segregation,investigation,treaty,accommodate,inheritance,tentative,utter,hijack,redundant,disrupt,conserve,lawsuit,graduate,handle,resolution,bewildered,fuss,confident,disguise,considerable,persistent,obligatory,expenses,initially,lecture,reluctance,extinct,toxic,precede,demolition,turnup,gap,disturb,independent,nerve,jusitification,turnout,compulsory,gathering,merciless,HomeOffice,impress,decline,diminish,essentially,deceive,advance,ambiguous,disposeof,disdain,apt,effort,famine,entirely,familiar,elderly,solution,commute,disproportionally,urge,obedience,retreat,merely,relief,distraction,principal,sanity,distortion,figure", ",")
For i = 0 To UBound(MyList())
Set r = ActiveDocument.Range
With r.Find
.Text = MyList(i)
.Replacement.Font.Underline = wdUnderlineSingle
.Execute Replace:=wdReplaceAll
End With
Next
End Sub
I want to get more characters in one string.
vba ms-word
vba ms-word
edited Mar 25 at 22:27
Osprey
asked Mar 25 at 22:10
OspreyOsprey
63 bronze badges
63 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I am not sure if String array has any such restriction, although VBA puts a restriction on length of each line. You can continue the same statement by adding an underscore '_' at the end.
Below is a modified version of your subroutine, I could create a long sentence (copy pasted your sentences several times) and was able to generate 700+ words.
Sub ListChange()
Dim r As Range
Dim MyList() As String
Dim i As Long
MyList = Split("segregation,investigation,treaty,accommodate,inheritance,tentative,utter,hijack,redundant,disrupt,conserve,lawsuit,graduate,handle,resolution,bewildered,fuss,confident,disguise,considerable,persistent,obligatory,expenses,initially,lecture,reluctance,extinct,toxic,precede,demolition,turnup,gap,disturb,independent,nerve,jusitification,turnout,compulsory,gathering,merciless,HomeOffice,impress,decline,diminish,essentially,deceive,advance,ambiguous,disposeof,disdain,apt,effort,famine,entirely,familiar,elderly,solution,commute,disproportionally,urge,obedience,retreat,merely,relief,distraction,principal,sanity,distortion,figure,welcome,world,hello,modification,activedocument,microsoft,hours,terminate,five,six,retinaeye,display,english,increase, " _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, tw0" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, days" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, days" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, days" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, days" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, days" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, days" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, stack" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, one", ", ")
For i = 0 To UBound(MyList())
Debug.Print (MyList(i))
Next
Debug.Print ("No of words found in sentence " & UBound(MyList()) + 1)
End Sub
Note: I am only printing the words (removed a section of your code). Hope this is what you are looking for..
Thank you, that was insightful. I don't have to create 10 Subs. The goal of this code is to identify words within a text and underline them. This would give students an indication on how many studied words are actually in the text.
– Osprey
Mar 26 at 6:42
Creating long lists of words as demonstrated by @Gro can be a bit tedious and can be problematical to maintain. A better solution which is relatively straightforward would be to create a Table in Word itself in a separate document and then from within your macro read in the individual words to your array/collection/dictionary.
– Freeflow
Mar 26 at 10:48
That would be very handy as I want to create something which is useful even less savvy teachers than myself. However, I would prefer Excel. I will go into this. Thank you.
– Osprey
Mar 26 at 22:02
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55347140%2fgetting-beyond-max-string-size-in-specific-vba-code%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I am not sure if String array has any such restriction, although VBA puts a restriction on length of each line. You can continue the same statement by adding an underscore '_' at the end.
Below is a modified version of your subroutine, I could create a long sentence (copy pasted your sentences several times) and was able to generate 700+ words.
Sub ListChange()
Dim r As Range
Dim MyList() As String
Dim i As Long
MyList = Split("segregation,investigation,treaty,accommodate,inheritance,tentative,utter,hijack,redundant,disrupt,conserve,lawsuit,graduate,handle,resolution,bewildered,fuss,confident,disguise,considerable,persistent,obligatory,expenses,initially,lecture,reluctance,extinct,toxic,precede,demolition,turnup,gap,disturb,independent,nerve,jusitification,turnout,compulsory,gathering,merciless,HomeOffice,impress,decline,diminish,essentially,deceive,advance,ambiguous,disposeof,disdain,apt,effort,famine,entirely,familiar,elderly,solution,commute,disproportionally,urge,obedience,retreat,merely,relief,distraction,principal,sanity,distortion,figure,welcome,world,hello,modification,activedocument,microsoft,hours,terminate,five,six,retinaeye,display,english,increase, " _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, tw0" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, days" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, days" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, days" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, days" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, days" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, days" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, stack" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, one", ", ")
For i = 0 To UBound(MyList())
Debug.Print (MyList(i))
Next
Debug.Print ("No of words found in sentence " & UBound(MyList()) + 1)
End Sub
Note: I am only printing the words (removed a section of your code). Hope this is what you are looking for..
Thank you, that was insightful. I don't have to create 10 Subs. The goal of this code is to identify words within a text and underline them. This would give students an indication on how many studied words are actually in the text.
– Osprey
Mar 26 at 6:42
Creating long lists of words as demonstrated by @Gro can be a bit tedious and can be problematical to maintain. A better solution which is relatively straightforward would be to create a Table in Word itself in a separate document and then from within your macro read in the individual words to your array/collection/dictionary.
– Freeflow
Mar 26 at 10:48
That would be very handy as I want to create something which is useful even less savvy teachers than myself. However, I would prefer Excel. I will go into this. Thank you.
– Osprey
Mar 26 at 22:02
add a comment |
I am not sure if String array has any such restriction, although VBA puts a restriction on length of each line. You can continue the same statement by adding an underscore '_' at the end.
Below is a modified version of your subroutine, I could create a long sentence (copy pasted your sentences several times) and was able to generate 700+ words.
Sub ListChange()
Dim r As Range
Dim MyList() As String
Dim i As Long
MyList = Split("segregation,investigation,treaty,accommodate,inheritance,tentative,utter,hijack,redundant,disrupt,conserve,lawsuit,graduate,handle,resolution,bewildered,fuss,confident,disguise,considerable,persistent,obligatory,expenses,initially,lecture,reluctance,extinct,toxic,precede,demolition,turnup,gap,disturb,independent,nerve,jusitification,turnout,compulsory,gathering,merciless,HomeOffice,impress,decline,diminish,essentially,deceive,advance,ambiguous,disposeof,disdain,apt,effort,famine,entirely,familiar,elderly,solution,commute,disproportionally,urge,obedience,retreat,merely,relief,distraction,principal,sanity,distortion,figure,welcome,world,hello,modification,activedocument,microsoft,hours,terminate,five,six,retinaeye,display,english,increase, " _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, tw0" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, days" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, days" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, days" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, days" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, days" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, days" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, stack" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, one", ", ")
For i = 0 To UBound(MyList())
Debug.Print (MyList(i))
Next
Debug.Print ("No of words found in sentence " & UBound(MyList()) + 1)
End Sub
Note: I am only printing the words (removed a section of your code). Hope this is what you are looking for..
Thank you, that was insightful. I don't have to create 10 Subs. The goal of this code is to identify words within a text and underline them. This would give students an indication on how many studied words are actually in the text.
– Osprey
Mar 26 at 6:42
Creating long lists of words as demonstrated by @Gro can be a bit tedious and can be problematical to maintain. A better solution which is relatively straightforward would be to create a Table in Word itself in a separate document and then from within your macro read in the individual words to your array/collection/dictionary.
– Freeflow
Mar 26 at 10:48
That would be very handy as I want to create something which is useful even less savvy teachers than myself. However, I would prefer Excel. I will go into this. Thank you.
– Osprey
Mar 26 at 22:02
add a comment |
I am not sure if String array has any such restriction, although VBA puts a restriction on length of each line. You can continue the same statement by adding an underscore '_' at the end.
Below is a modified version of your subroutine, I could create a long sentence (copy pasted your sentences several times) and was able to generate 700+ words.
Sub ListChange()
Dim r As Range
Dim MyList() As String
Dim i As Long
MyList = Split("segregation,investigation,treaty,accommodate,inheritance,tentative,utter,hijack,redundant,disrupt,conserve,lawsuit,graduate,handle,resolution,bewildered,fuss,confident,disguise,considerable,persistent,obligatory,expenses,initially,lecture,reluctance,extinct,toxic,precede,demolition,turnup,gap,disturb,independent,nerve,jusitification,turnout,compulsory,gathering,merciless,HomeOffice,impress,decline,diminish,essentially,deceive,advance,ambiguous,disposeof,disdain,apt,effort,famine,entirely,familiar,elderly,solution,commute,disproportionally,urge,obedience,retreat,merely,relief,distraction,principal,sanity,distortion,figure,welcome,world,hello,modification,activedocument,microsoft,hours,terminate,five,six,retinaeye,display,english,increase, " _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, tw0" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, days" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, days" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, days" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, days" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, days" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, days" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, stack" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, one", ", ")
For i = 0 To UBound(MyList())
Debug.Print (MyList(i))
Next
Debug.Print ("No of words found in sentence " & UBound(MyList()) + 1)
End Sub
Note: I am only printing the words (removed a section of your code). Hope this is what you are looking for..
I am not sure if String array has any such restriction, although VBA puts a restriction on length of each line. You can continue the same statement by adding an underscore '_' at the end.
Below is a modified version of your subroutine, I could create a long sentence (copy pasted your sentences several times) and was able to generate 700+ words.
Sub ListChange()
Dim r As Range
Dim MyList() As String
Dim i As Long
MyList = Split("segregation,investigation,treaty,accommodate,inheritance,tentative,utter,hijack,redundant,disrupt,conserve,lawsuit,graduate,handle,resolution,bewildered,fuss,confident,disguise,considerable,persistent,obligatory,expenses,initially,lecture,reluctance,extinct,toxic,precede,demolition,turnup,gap,disturb,independent,nerve,jusitification,turnout,compulsory,gathering,merciless,HomeOffice,impress,decline,diminish,essentially,deceive,advance,ambiguous,disposeof,disdain,apt,effort,famine,entirely,familiar,elderly,solution,commute,disproportionally,urge,obedience,retreat,merely,relief,distraction,principal,sanity,distortion,figure,welcome,world,hello,modification,activedocument,microsoft,hours,terminate,five,six,retinaeye,display,english,increase, " _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, tw0" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, days" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, days" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, days" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, days" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, days" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, days" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, stack" _
& "segregation , investigation, treaty, accommodate, inheritance, tentative, utter, hijack, redundant, disrupt, conserve, lawsuit, graduate, Handle, resolution, bewildered, fuss, confident, disguise, considerable, persistent, obligatory, expenses, initially, lecture, reluctance, extinct, toxic, precede, demolition, turnup, Gap, disturb, independent, nerve, jusitification, turnout, compulsory, gathering, merciless, HomeOffice, impress, decline, diminish, essentially, deceive, advance, ambiguous, disposeof, disdain, apt, effort, famine, entirely, familiar, elderly, solution, commute, disproportionally, urge, obedience, retreat, merely, relief, distraction, principal, sanity, distortion, figure, welcome, world, hello, modification, activedocument, microsoft, hours, Terminate, five, one", ", ")
For i = 0 To UBound(MyList())
Debug.Print (MyList(i))
Next
Debug.Print ("No of words found in sentence " & UBound(MyList()) + 1)
End Sub
Note: I am only printing the words (removed a section of your code). Hope this is what you are looking for..
answered Mar 26 at 3:11
GroGro
5054 silver badges9 bronze badges
5054 silver badges9 bronze badges
Thank you, that was insightful. I don't have to create 10 Subs. The goal of this code is to identify words within a text and underline them. This would give students an indication on how many studied words are actually in the text.
– Osprey
Mar 26 at 6:42
Creating long lists of words as demonstrated by @Gro can be a bit tedious and can be problematical to maintain. A better solution which is relatively straightforward would be to create a Table in Word itself in a separate document and then from within your macro read in the individual words to your array/collection/dictionary.
– Freeflow
Mar 26 at 10:48
That would be very handy as I want to create something which is useful even less savvy teachers than myself. However, I would prefer Excel. I will go into this. Thank you.
– Osprey
Mar 26 at 22:02
add a comment |
Thank you, that was insightful. I don't have to create 10 Subs. The goal of this code is to identify words within a text and underline them. This would give students an indication on how many studied words are actually in the text.
– Osprey
Mar 26 at 6:42
Creating long lists of words as demonstrated by @Gro can be a bit tedious and can be problematical to maintain. A better solution which is relatively straightforward would be to create a Table in Word itself in a separate document and then from within your macro read in the individual words to your array/collection/dictionary.
– Freeflow
Mar 26 at 10:48
That would be very handy as I want to create something which is useful even less savvy teachers than myself. However, I would prefer Excel. I will go into this. Thank you.
– Osprey
Mar 26 at 22:02
Thank you, that was insightful. I don't have to create 10 Subs. The goal of this code is to identify words within a text and underline them. This would give students an indication on how many studied words are actually in the text.
– Osprey
Mar 26 at 6:42
Thank you, that was insightful. I don't have to create 10 Subs. The goal of this code is to identify words within a text and underline them. This would give students an indication on how many studied words are actually in the text.
– Osprey
Mar 26 at 6:42
Creating long lists of words as demonstrated by @Gro can be a bit tedious and can be problematical to maintain. A better solution which is relatively straightforward would be to create a Table in Word itself in a separate document and then from within your macro read in the individual words to your array/collection/dictionary.
– Freeflow
Mar 26 at 10:48
Creating long lists of words as demonstrated by @Gro can be a bit tedious and can be problematical to maintain. A better solution which is relatively straightforward would be to create a Table in Word itself in a separate document and then from within your macro read in the individual words to your array/collection/dictionary.
– Freeflow
Mar 26 at 10:48
That would be very handy as I want to create something which is useful even less savvy teachers than myself. However, I would prefer Excel. I will go into this. Thank you.
– Osprey
Mar 26 at 22:02
That would be very handy as I want to create something which is useful even less savvy teachers than myself. However, I would prefer Excel. I will go into this. Thank you.
– Osprey
Mar 26 at 22:02
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55347140%2fgetting-beyond-max-string-size-in-specific-vba-code%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown