Word Combination Maker
Posted March 5th, 2009 by Ryan Olbe Adwords Tools, Visual Basic Projects Add commentsHere's the source code to a Visual Basic project I originally wrote on June 06, 2005 called "Word Combination Maker". This is somewhat similar to my Word Combiner program. This program has to do with string permutations (or rather the permutations of words). It takes a series of words and it can tell you all the different possible ways those words can be re-arranged. Here's an example, let's say I type "A B C". This is composed of 3 individual words (A, B, and C). This can be arranged 6 different ways: "ABC, ACB, BAC, BCA, CAB, CBA". Well that's easy to understand but what about for 4 words, or 5 words? There's a lot more combinations as the number of words grow (it grows exponentially in fact). It can get pretty complicated by hand, so that's why I wrote this program. It would probably be most useful for people advertising on PPC advertising programs like Google Adwords because it allows you to pick out certain keywords and phrases that you can bid on "exactly". All the different ways of combining a series of words can be found with this program. Feedback and comments are welcome.
Download word_combination_maker.zip (June 06, 2005)

Filelist
Form1.frm
Module1.bas
'Generates all possible combinations from a series of words Public Function PermutateString(ByVal input_string As String, Optional Base As String = "") As String Dim i As Long Dim TmpStrArray() As String 'If there's only 1 element, then If InStr(1, input_string, " ", vbTextCompare) = 0 Then PermutateString = Base & " " & input_string & vbCrLf Exit Function End If 'If more than 1 element, split elements in one array of elements TmpStrArray = Split(input_string, " ", , vbTextCompare) If Base = "" Then 'Loop trough each element and do callbacks to permutate again For i = LBound(TmpStrArray) To UBound(TmpStrArray) PermutateString = PermutateString & PermutateString(ReturnAllBut(TmpStrArray, i), TmpStrArray(i)) Next Else 'Loop trough each element and do callbacks to permutate again For i = LBound(TmpStrArray) To UBound(TmpStrArray) PermutateString = PermutateString & PermutateString(ReturnAllBut(TmpStrArray, i), Base & " " & TmpStrArray(i)) Next End If End Function 'Return all items in a array but 1 Public Function ReturnAllBut(ByRef strArray() As String, But As Long) As String Dim i As Long For i = LBound(strArray) To UBound(strArray) If i <> But Then ReturnAllBut = ReturnAllBut & strArray(i) & " " End If Next ReturnAllBut = RTrim(ReturnAllBut) End Function
Thank you...
what if you want to use one word more than once?
Cool tool! I'd love to see the option to do every possible combination as well, like "dog" "cat" "mouse" could return "dog cat" or just "mouse". Or better yet, just allow certain words to be optional for a similar effect!
Thank you SO much, you have no idea how much this helped.
Thanks for the compiled version!
THANKS
This does not open on my Windows 7 PC. Is this normal?
You may be running a 64-bit version of Windows, which sometimes has trouble with 32-bit programs. I would try running it in compatibility mode. Right-click on the .EXE and choose Properties, then choose the Compatibility, and choose to run in Compatibility Mode for Windows XP (Service Pack 2). It that doesn't work, the only other option would be to recompile it using the latest version of Visual Studio, which I don't have, but you can download a free trial of here...
http://www.microsoft.com/visualstudio/en-us