View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
GS[_6_] GS[_6_] is offline
external usenet poster
 
Posts: 1,182
Default Problem encountered with Debug.Print message being passed to subroutine

Note that using vbTab applies the tab spacing set on the VBE OptionsGeneral
tab, whereas using the Space() function allows you to specify the spacing
between string sets.

I have the following function that accepts an Integer arg for the spacing I
want to use between sections when building strings. I also know that "Tab" is a
keyword and so have no idea why I didn't pick up on that; - sory, my bad!

So...

Public Function SetTab$(iLen%)
' Returns a set length string of spaces
' Args: iLen% The number of spaces

SetTab = Space(iLen)
End Function 'SetTab()

...and I use it like so...

Sub test_SetTab()
Dim s1$
s1 = "A" & vbTab & "B" & vbTab & "C"
Debug.Print s1
s1 = "Part1:" & SetTab(10) & "Part2;" & SetTab(5) & "Part3!"
Debug.Print s1
End Sub

...which returns the following:

A B C
Part1: Part2; Part3!

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion