Question on Removing Characters
Does the RemoveUnderscores subroutine remove the underscores from
ScreenTextB? If not, then your problem is you are testing the length of
ScreenTextB and if it doesn't change, then you will be in the wrong part of
your If..Then test.
--
Rick (MVP - Excel)
"TomP" wrote in message
...
I'm gathering numbers (text) from a screen and want to format it in
telephone
format before I place it in the spreadsheet. First, I need to remove the
underscores and have that in place which works. "RemoveUnderscores" is a
subroutine that gets rid of the underscores.
The problem is when there is no phone number to grab, I get and left/right
brackets along with the underscores. I would think that
Else
CPPHONE = ""
would work.
ScreenTextB is actually pulling the object for me and it works fine.
Dim CPPHONE as String
RemoveUnderscores
If Len(ScreenTextB) = 12 Then
CPPHONE = "(" & Left(ScreenTextB, 3) & ") " &
Mid(ScreenTextB, 5, 3) & "-" & Right(ScreenTextB, 4)
Else
CPPHONE = ""
End If
Thank you for your help!
Tom
|