Text Scrambler/Replacer (VBA for Excel)

This was a VBA for Excel project. The program takes as input a series of text strings. In each of these text strings there is a specific word. For each of these words the user provides a list of values to replace them with. The program produces all possible combinations of these text strings replaced by the values provided by the user.

 

 

Project Requirements:

  • Excel
  • VBA
  • GUI

Project Description: 

In this project the client requested an excel gui with input fields (Main, Title, Tracking and Tag text fields). In each field the user would input text. In the text there were variables in the format VARx (where x was an Integer) for example VAR1, VAR2, VAR3 . . . The main purpose of this project was to search for these variables in the text and replace them with all the possible combinations of a set of predefined values. Asides from that the client also requested some specific customization:

 1-  When replacing the variables in the Main, Tracking and the Tag text fields, the variables should have the same values as the variables in the Title text field. For example:

 Lets say these are the variables in the Title text:

VAR1, VAR2

and these are the variables in the body text:

VAR1, VAR3, VAR4

and lets say these are the values being assigned to the variables

VAR1 = VALUE1_A, VALUE1_B
VAR2 = VALUE2_A, VALUE2_B,VALUE2_C
VAR3 = VALUE3_A
VAR4 = VALUE4_A, VALUE4_B, VALUE4_C,VALUE4_D

This would be a valid combination:

Title:
VALUE1_A, VALUE2_A

Body
VALUE1_A,VALUE3_B, VALUE4_D

See how VAR1 has the same value in both texts, but the combination below would not be acceptable:

Title: VALUE1_A, VALUE2_A
Body:VALUE2_A,VALUE3_B, VALUE4_D
Since VAR1 has taken different values in the title and the main text.

 2-  Another customization the client requested was that the variables that were not in the title should be given a random value from the set of predefined values.

Step 1:  The user input text in to four different fields. Main, Body, Tags and Tracking. As mentioned above in each of these fields there are strings in the format VARx.
User Input

User Input

 

Step 2: After pressing the run button, in the second tab the variables that have been detected will show. Here the user can select the data to replace these variables with.

User Input

User Input

Step 3: After pressing the run button the results are printed in an excel sheet. Below you can see 3 of the rows.

Results

Results

Live Chat
%d bloggers like this: