Does anyone know how I can loop through a nine letter word & get all the
combinations of those nine letters (i.e., an anagram solver)?

Many thanks,

Terry

Re: All combinations of a nine letter word by Steven

Steven
Sat Jan 03 20:22:32 CST 2004

On Sat, 3 Jan 2004 16:36:17 -0000, "Terry Hornsby"
<t.hornsby@lineone.net> wrote:

>Does anyone know how I can loop through a nine letter word & get all the
>combinations of those nine letters (i.e., an anagram solver)?

Do you want to program it yourself, or do you just want results?

1. As somebody mentioned, this really isn't a good application for
VBA.

2. If you just want an anagram solver, there are lots of those on the
web. Just search for "anagram solver" (without the quote marks)

http://www.easypeasy.com/anagrams


--
Steve M - unspam@houston.rrwax.com (remove wax for reply)

Chaos. I can relate to that. My life is chaos most of the time. I
am in tune with the universe. It feels like home. -- Robert Fulghum

Re: All combinations of a nine letter word by Brian>

Brian>
Sat Jan 03 21:07:45 CST 2004

I just wrote one of these a month ago because my wife always beats me at
them. One tip regarding culling out the spelling errors is to avoid using a
For Each ... Next, looping through each item in the SpellingErrors
collection (really any technique that involves the SpellingErrors collection
takes a while when it has to go through a list as long as the one you'll
generate). Rather, try using SpellingErrorType <> wdSpellingCorrect in an
If ... Then line. It took about 1/20th the time to run.

-Brian


Malcolm Smith <malcolm.smith@DragAndDrop.com> wrote in message
news:memo.20040103174147.2436C@mksmith.aits-uk.net...
> One way is to create a list of words and then check them against the
> Dictionary object.
>
> It will be slow. Very slow.
>
> It would be better to get hold of a dictionary in a text file and then use
> something like Perl to make each combination of the letters and to check
> against the dictionary.
>
> I wouldn't use Word for this at all.
>
> - Malc
> www.dragondrop.com



Re: All combinations of a nine letter word by mail

mail
Sat Jan 03 22:45:40 CST 2004

Hi Terry,

Have a look at this web page and save yourself a lot of coding. There
are probably other web sites that do the same thing, and you may be
able to find some freeware too. Some electronic dictionaries (e.g. my
Webster) offer anagrams as an option as well.

http://www.anagramgenius.com/server.html

Regards,
Theo van der Ster


"Terry Hornsby" <t.hornsby@lineone.net> wrote in message news:<ujXuAfh0DHA.1532@TK2MSFTNGP10.phx.gbl>...
> Does anyone know how I can loop through a nine letter word & get all the
> combinations of those nine letters (i.e., an anagram solver)?
>
> Many thanks,
>
> Terry

Re: All combinations of a nine letter word by mail

mail
Sat Jan 03 22:54:07 CST 2004

Hi Terry,

This is a better web page. It gives you the results immediately
instead of sending them thru the mail.

Regards,
Theo van der Ster

"Terry Hornsby" <t.hornsby@lineone.net> wrote in message news:<ujXuAfh0DHA.1532@TK2MSFTNGP10.phx.gbl>...
> Does anyone know how I can loop through a nine letter word & get all the
> combinations of those nine letters (i.e., an anagram solver)?
>
> Many thanks,
>
> Terry

Re: All combinations of a nine letter word by Terry

Terry
Sun Jan 04 02:01:28 CST 2004

Thanks for all the suggestions, particularly Malcolm for the preferred
spelling error check in Word. I had simply used checkspelling.

I have seen the stand-alone programs & the server-based anagram makers (some
of them are gobsmackingly amazing), but I was wanting code for vba because I
have a created an Excel-based game that will see use at family
get-togethers.

I can see no way around a for each & do loop structure (by combining the two
forms of the loop I think I can reduce the lines of looping code down to 12,
excluding the lines which deal with the actual string. Something like: -

Set RngCube = Range("E2:G4")

For Each RngCell In RngCube
StrResult = StrResult & RngCell
Next RngCell
IntTote = 6

IntA=9
do while IntA >=4
for Int1 = 1 to IntA
''''''Pass string (using a mid statement) to the
spellchecker
'''''something like (the following DOES need amending!
StrTmp = Right(StrResult, Len(StrResult) - IntA) &
Left(StrResult, IntA)
If Application.CheckSpelling(StrTmp) = True Then
Range("A" & IntTote) = StrTmp
IntTote = IntTote + 1
End If
IntB=IntA-1
if inta<=8 then
do while IntB >=1
for Int2 = 1 to IntB
''''''Pass string (using a mid statement) to the
spellchecker, taking IntB as the mid character position
'''''something like (the following DOES need amending!
StrTmp = Right(StrResult, Len(StrResult) - IntB) &
Left(StrResult, IntB)
If Application.CheckSpelling(StrTmp) = True Then
Range("A" & IntTote) = StrTmp
IntTote = IntTote + 1
End If
Next Int2
Int2=Int2-1 ''replace one character with another from
the remaining 8 characters
Loop
End if
Next Int1
IntA=IntA-1 ''remove one character from the original 9 one at a
time until only 4 remain
Loop


'''This bit creates my random 9 letters (which I alter to ensure
3 letters are vowels)
Sub RndmLtrGenrtr()
Dim RngCube As Range, RngCell As Range, IntArr As Integer, IntTote As
Integer, _
IntCount As Integer, StrResult As String, VarVwls As Variant, BoolFound As
Boolean

VarVwls = Array("A", "E", "I", "O", "U", "Y")

Set RngCube = Range("E2:G4")
RngCube.ClearContents
For Each RngCell In RngCube
StrResult = Chr(Int((90 - 65 + 1) * Rnd + 65))
RngCell = StrResult
Next RngCell

For Each RngCell In RngCube
For IntArr = 0 To 5
If RngCell = VarVwls(IntArr) Then
IntTote = IntTote + 1
End If
Next IntArr
Next RngCell

IntCount = 3 - IntTote
If IntCount > 0 Then

For IntTote = 1 To IntCount
For Each RngCell In RngCube
BoolFound = False
For IntArr = 0 To 5
If RngCell = VarVwls(IntArr) Then
BoolFound = True
Exit For
End If
Next IntArr

If BoolFound = False Then
StrResult = VarVwls(Int((6 - 1 + 1) * Rnd + 1) - 1)
RngCell = StrResult
Exit For
End If
Next RngCell
Next IntTote
End If
End Sub

Thanks to all once again,

Terry.

"Theo van der Ster" <mail@sterlingwaen.com> wrote in message
news:ea60a533.0401032054.7158e5b7@posting.google.com...
> Hi Terry,
>
> This is a better web page. It gives you the results immediately
> instead of sending them thru the mail.
>
> Regards,
> Theo van der Ster
>
> "Terry Hornsby" <t.hornsby@lineone.net> wrote in message
news:<ujXuAfh0DHA.1532@TK2MSFTNGP10.phx.gbl>...
> > Does anyone know how I can loop through a nine letter word & get all the
> > combinations of those nine letters (i.e., an anagram solver)?
> >
> > Many thanks,
> >
> > Terry