Space character?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dmorand
    New Member
    • Sep 2007
    • 219

    Space character?

    Anyone know what the space character is represented as in VBA?

    I'm trying to run a replace function to replace all space characters with underscores.

    Code:
    Dim newCaption As String
    newCaption = Replace(caption, " ", "_")
  • Jim Doherty
    Recognized Expert Contributor
    • Aug 2007
    • 897

    #2
    Originally posted by dmorand
    Anyone know what the space character is represented as in VBA?

    I'm trying to run a replace function to replace all space characters with underscores.

    Code:
    Dim newCaption As String
    newCaption = Replace(caption, " ", "_")

    that will work as is....provided the variable caption has something assigned to it as a string value already.

    I am guessing here but....Is the word caption the property of a screen control ie a label or the forms caption because if that is the case the word caption should be referenced properly! (ie: Me!Label.captio n or Me.caption in the case of a form itself) so that we can understand it much better as being that.... rather than being an apparent 'variable' by your posting. If it is a variable then you should really steer clear of defining variables that have same names as properties in favour of naming it something less similar to avoid confusion.

    Regards

    Jim :)

    Comment

    • dmorand
      New Member
      • Sep 2007
      • 219

      #3
      Thanks Jim, I got it working!

      Comment

      Working...