View Single Post
  #3 (permalink)  
Old January 14th, 2006, 07:14 PM
alastair alastair is offline
Authorized User
 
Join Date: Dec 2005
Location: , , .
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Civa, here's your answer and a few other points too.

1. The function doesn't return any text because "Exit Function" happens before "Getwords = Words" has run. Move the assignment in front of the exit:

        If Len(Trim(Pno)) = 0 Then
            GetWords = Words
            Exit Function
        End If
    Next


2. I'm intrigued about the function and would be interested to see some examples of the input and the output you want them to generate.

3. Some of your code, while quite correct, could be written in a more readable way! For example:

        Pno = Mid(Pno, 1, Len(Pno) - IIf(J = 1 Or J = 5, 1, 2))

is easier to read as:

   If (J=1) or (J=5) Then
      Pno = Left(Pno, Len(Pno) - 1)
   Else
      Pno = Left(Pno, Len(Pno) - 2)
   End If

Good luck with the rest.
Reply With Quote