View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Remove spaces from a string variable

Hi blatham

Replace and some other string functions are not available in XL97

Use Substitute in XL97, and the slightly faster Replace for later versions.
The conditional #If VBA6 will prevent a compile error in XL97's VBA5.

Sub test()

#If VBA6 Then
myStr = Replace("dunno why...", "dunno", "do know")
#Else ' it's XL97
myStr = Application.Substitute("dunno why...", "dunno", "do know")
#End If

End Sub

Regards,
Peter T

"blatham" wrote in
message ...

Nah, perhaps it was introduced in a later version. Suppose 97 is a bit
old now! Thanks anyway.


--
blatham
------------------------------------------------------------------------
blatham's Profile:

http://www.excelforum.com/member.php...o&userid=19441
View this thread: http://www.excelforum.com/showthread...hreadid=398507