Link to home
Start Free TrialLog in
Avatar of deva_rajesh
deva_rajesh

asked on

Vbtab - Not working

Hi
Iam generating email thru' V.basic-6.0 using winsock
And formatting the message body using 'vbtab'.
'vbcrlf' is working but 'vbtab' does't show any effect to the message body.

Example:
       msgbody = variable1 & vbtab & varaible2

When msgbody is directed to email , it shows as below
       variable1variable2

But I would like to have the result as
       variable1      variable2    

Suggestion pls...

Thanks
Deva
Avatar of Reggie_BE
Reggie_BE

and can't you replace vbtab by some spaces ?

& space(10) &
or just try tab(1) ;)
Avatar of deva_rajesh

ASKER

Hi
using space() creates space but does't work as tab ..
tab(1) is not working
Deva
and SendKeys ("{TAB}") ?
Giving me the error

expected function or variable

Deva
Hi,
Use a function to format the width of the variables before printing:

Function FormatWidthOf(var1, myWidth) As String

    FormatWidthOf = CStr(var1)
    While Me.TextWidth(FormatWidthOf) < myWidth
        FormatWidthOf = " " & FormatWidthOf
    Wend

End Function

Private Sub Command1_Click()
    Me.Font = Text1.Font
    Me.FontSize = Text1.FontSize
    Text1.Text = ""

    myWidth = Me.TextWidth("01234567890")

    var1 = 123.45
    var2 = 6.78
   
    Text1.Text = Text1.Text & FormatWidthOf(var1, myWidth) & FormatWidthOf(var2, myWidth) & vbCrLf

     
End Sub
Avatar of avya2k
better use
msgbody = variable1 & chr(9) & varaible2
hi , its somewhat ok, but not creating space as exactly as vbtab does.
chr(9) is also giving no effect
umm

""& variable1 &"" & vbtab & ""& varaible2 &""
vbtab and chr(9) is one and the same

what method u r using or in what control you are formatting your msgbody

 ""& variable1 &"" & vbtab & ""& varaible2 &"" 

I hv to use quotation mark or something else ?

HI i thinkg the content type should b changed

I use

Call SendData(mysock, "Content-Type: text/html; charset=ISO-8859-9" & vbCrLf)

Should i change this to something else?
umm....i don't know what type of varaible 1&2 are,

but i suggest change it to string first.

str(varaible1) & vbtab & str(varaible2)
if you have set content type to html or your mailbody is in html format then you can not insert tab by chr(9) or vbtab
you have to do it like this

variable1 & "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" & varaible2

&nbsp; = one space
this is how one should insert more than one space characters in HTML
If you use the <PRE> </PRE> tags, you don't need &nbsp; to insert spaces. The text between <PRE> and </PRE> will appear as is.

<html>
<TITLE></TITLE>
<BODY>
<PRE>

   AIM Global Technology           $    10.8320      
   AIM Global Health Sciences Cla  $     5.7070      
   AIM RSP European Growth         $     3.9730  
   
</PRE>

</BODY>
</HTML>
Hi deva_rajesh,
This old question (QID 20567247) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

 -->PAQ - no points refunded

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER

GPrentice00
Cleanup Volunteer
ASKER CERTIFIED SOLUTION
Avatar of YensidMod
YensidMod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial