VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Keyword Combiner"
   ClientHeight    =   5715
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6420
   Icon            =   "Form1.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   5715
   ScaleWidth      =   6420
   StartUpPosition =   2  'CenterScreen
   Begin VB.CheckBox Check1 
      Caption         =   "Include spaces in-between words"
      Height          =   255
      Left            =   1845
      TabIndex        =   13
      Top             =   2065
      Width           =   2730
   End
   Begin VB.TextBox Text1 
      Height          =   300
      Index           =   4
      Left            =   2400
      TabIndex        =   11
      Text            =   "1, 2, 3"
      Top             =   885
      Width           =   3735
   End
   Begin VB.TextBox Text1 
      BackColor       =   &H00C0FFFF&
      Height          =   300
      Index           =   3
      Left            =   2400
      Locked          =   -1  'True
      TabIndex        =   9
      Text            =   "27"
      Top             =   1680
      Width           =   3735
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Go"
      Default         =   -1  'True
      Height          =   440
      Index           =   2
      Left            =   1489
      TabIndex        =   7
      Top             =   5050
      Width           =   1575
   End
   Begin VB.CommandButton Command1 
      Caption         =   "E&xit"
      Height          =   440
      Index           =   1
      Left            =   3357
      TabIndex        =   6
      Top             =   5050
      Width           =   1575
   End
   Begin VB.TextBox Text1 
      Height          =   2460
      Index           =   2
      Left            =   240
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   5
      Top             =   2400
      Width           =   5895
   End
   Begin VB.TextBox Text1 
      Height          =   300
      Index           =   1
      Left            =   2400
      TabIndex        =   4
      Text            =   "4, 5, 6"
      Top             =   1275
      Width           =   3735
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Copy"
      Enabled         =   0   'False
      Height          =   255
      Index           =   0
      Left            =   5400
      TabIndex        =   3
      Top             =   4920
      Width           =   735
   End
   Begin VB.TextBox Text1 
      Height          =   300
      Index           =   0
      Left            =   2400
      TabIndex        =   2
      Text            =   "yellow, orange, red"
      Top             =   480
      Width           =   3735
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "Keyword Combiner"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   -1  'True
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   240
      Index           =   6
      Left            =   2235
      TabIndex        =   12
      Top             =   120
      Width           =   1950
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "And put one of these before it:"
      Height          =   195
      Index           =   3
      Left            =   105
      TabIndex        =   10
      Top             =   930
      Width           =   2145
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "Number of combinations is:"
      Height          =   195
      Index           =   2
      Left            =   345
      TabIndex        =   8
      Top             =   1725
      Width           =   1905
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "And put one of these after it:"
      Height          =   195
      Index           =   1
      Left            =   240
      TabIndex        =   1
      Top             =   1320
      Width           =   2010
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "Take each of these words:"
      Height          =   195
      Index           =   0
      Left            =   360
      TabIndex        =   0
      Top             =   525
      Width           =   1905
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Command1_Click(Index As Integer)
Select Case Index
'Copy to Clipboard clicked
Case 0
 Clipboard.Clear
 Clipboard.SetText Text1(2).Text
 MsgBox "Successfully copied to the clipboard!", vbOKOnly + vbInformation, "Word Combiner"
'Exit clicked
Case 1
 Unload Me
'Go clicked
Case 2
 Dim TmpStrArray1() As String, TmpStrArray2() As String, TmpStrArray3() As String
 Dim i As Integer, j As Integer, k As Integer
 TmpStrArray1 = Split(Text1(0).Text, ", ", , vbTextCompare) 'original words
 TmpStrArray2 = Split(Text1(4).Text, ", ", , vbTextCompare) 'words to add before
 TmpStrArray3 = Split(Text1(1).Text, ", ", , vbTextCompare) 'words to add after
 Dim space As String
 space = ""
 If Check1.Value = 1 Then
  space = " "
 End If
 
 'nothing goes before and nothing goes after
 If Len(Text1(4).Text) = 0 And Len(Text1(1).Text) = 0 Then
  Text1(2).Text = ""
  For i = LBound(TmpStrArray1) To UBound(TmpStrArray1)
   Text1(2).Text = Text1(2).Text & TmpStrArray1(i)
   If i <> UBound(TmpStrArray1) Then Text1(2).Text = Text1(2).Text & vbCrLf
  Next i
  
 'nothing goes before, something goes after
 ElseIf Len(Text1(4).Text) = 0 And Len(Text1(1).Text) > 0 Then
  Text1(2).Text = ""
  For i = LBound(TmpStrArray1) To UBound(TmpStrArray1)
   For j = LBound(TmpStrArray3) To UBound(TmpStrArray3)
    Text1(2).Text = Text1(2).Text & TmpStrArray1(i) & space & TmpStrArray3(j)
    If j <> UBound(TmpStrArray3) Then Text1(2).Text = Text1(2).Text & vbCrLf
   Next j
   If i <> UBound(TmpStrArray1) Then Text1(2).Text = Text1(2).Text & vbCrLf
  Next i
  
 'something goes before, nothing goes after
 ElseIf Len(Text1(4).Text) > 0 And Len(Text1(1).Text) = 0 Then
  Text1(2).Text = ""
  For i = LBound(TmpStrArray1) To UBound(TmpStrArray1)
   For j = LBound(TmpStrArray2) To UBound(TmpStrArray2)
    Text1(2).Text = Text1(2).Text & TmpStrArray2(j) & space & TmpStrArray1(i)
    If j <> UBound(TmpStrArray2) Then Text1(2).Text = Text1(2).Text & vbCrLf
   Next j
   If i <> UBound(TmpStrArray1) Then Text1(2).Text = Text1(2).Text & vbCrLf
  Next i
  
 'something goes before and something goes after
 ElseIf Len(Text1(4).Text) > 0 And Len(Text1(1).Text) > 0 Then
  Text1(2).Text = ""
  For i = LBound(TmpStrArray1) To UBound(TmpStrArray1)
   For j = LBound(TmpStrArray2) To UBound(TmpStrArray2)
    For k = LBound(TmpStrArray3) To UBound(TmpStrArray3)
     Text1(2).Text = Text1(2).Text & TmpStrArray2(j) & space & TmpStrArray1(i) & space & TmpStrArray3(k)
     If k <> UBound(TmpStrArray3) Then Text1(2).Text = Text1(2).Text & vbCrLf
    Next k
    If j <> UBound(TmpStrArray2) Then Text1(2).Text = Text1(2).Text & vbCrLf
   Next j
   If i <> UBound(TmpStrArray1) Then Text1(2).Text = Text1(2).Text & vbCrLf
  Next i
 End If
 
End Select
End Sub

Private Sub Text1_Change(Index As Integer)
 Command1(0).Enabled = IIf(Len(Text1(2).Text) > 0, True, False)
End Sub

Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
If Shift = 2 And KeyCode = 65 Then 'CTRL-A is being held down, so select all
 Text1(Index).SelStart = 0
 Text1(Index).SelLength = Len(Text1(Index).Text)
End If
End Sub

Private Sub Text1_KeyUp(Index As Integer, KeyCode As Integer, Shift As Integer)
Dim multiplier As Integer
multiplier = IIf(Len(Text1(0).Text) > 0, UBound(Split(Text1(0).Text, ", ", , vbTextCompare)) + 1, 1)
Text1(3).Text = multiplier
multiplier = IIf(Len(Text1(4).Text) > 0, UBound(Split(Text1(4).Text, ", ", , vbTextCompare)) + 1, 1)
Text1(3).Text = CInt(Text1(3).Text) * multiplier
multiplier = IIf(Len(Text1(1).Text) > 0, UBound(Split(Text1(1).Text, ", ", , vbTextCompare)) + 1, 1)
Text1(3).Text = CInt(Text1(3).Text) * multiplier
End Sub