Thursday, September 21, 2006

Warming up with VBA II

OK... ready for this weeks VBA warmup?? Try creating subs for these two problems below (using the InputBox and MsgBox functions, together with two mystery functions that you'll have to find!)
  1. Before the sale of Telstra, Sol is keen to rename the company back to it's previous name of Telecom. Create a new Sub called Telecom that will ask the user to enter some text. Your sub will then modify the text entered by the user by replacing the word "telstra" with "telecom" and display the result in a MsgBox.
  2. Create a new Sub called Translate(), that asks the user to enter some text to translate. Your sub will then replace any occurrence of "Hello" with "Bon jour" (or a word from another language that you are familiar with) .(Remember to do this in steps, testing every time!
  3. Modify your Translate() sub so that any occurrence of the word "what" is replaced with "was" (or a word from another language you are familiar with!)
  4. Modify your Translate() sub so that any occurrence of the word "dog" is replaced with "hund" (or the relevant word from another language that you are familiar with!)
  5. Create a new Sub called RandomNumber that will display a random number between 0 and 100 in a MsgBox each time you run it.

0 Comments:

Post a Comment

<< Home