Results 1 to 7 of 7

Thread: [RESOLVED] Stack

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2007
    Posts
    25

    Resolved [RESOLVED] Stack

    Hi All,

    I was wondering how i could get the text to stack on top of each other like seen after end select
    The text is getting sent to a rich text box

    VB Code:
    1. Case "test"
    2.        If coding.SelLength > 0 Then
    3.           coding.SelText = "<html>"
    4.           coding.SelText = "<head>"
    5.        coding.SelText = "<TITLE>" & coding.SelText & "</TITLE>"
    6.        Else
    7.           coding.SelText = "<html>"
    8.           coding.SelText = "<head>"
    9.           coding.SelText = "<TITLE>TITLE</TITLE>"
    10.        End If
    11.  
    12. End Select
    13.  
    14. '<head>
    15. '<title></title>
    16. '</head>
    17. '<body bgcolor="#FFFFFF">
    18. '</body>
    19. '</html>
    20. 'Its coming out in a like like this
    21. '<head><title></title></head><body bgcolor="#FFFFFF"></body></html>
    22. 'Its coming out like this
    23. '<head><title></title></head><body bgcolor="#FFFFFF"></body></html>
    Last edited by Jazza; Jan 29th, 2007 at 03:20 PM.

  2. #2
    Addicted Member
    Join Date
    Mar 2006
    Posts
    178

    Re: Stack

    add 'vbCRLF' after each line of text i.e.
    VB Code:
    1. coding.SelText = "<html>" & vbcrlf

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jan 2007
    Posts
    25

    Re: Stack

    Perfect!
    Thanks

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Jan 2007
    Posts
    25

    Re: Stack

    VB Code:
    1. coding.SelText = "<body bgcolor="#FFFFFF">"

    Any idea on how to avoid the syntax error caused by # ?


    Thanks

  5. #5
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Stack

    It's not caused by the #, it is caused by " (which marks the end of a string)

    The simplest way to put the " character into a string is to double-up like this:
    VB Code:
    1. coding.SelText = "<body bgcolor=[u]""[/u]#FFFFFF[u]""[/u]>"

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Jan 2007
    Posts
    25

    Re: Stack

    OH I see what you are saying

    Thanks that did the trick

  7. #7
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Stack

    Everybody has their own style but I think that it's easier to understand (later) what's going on if you do

    VB Code:
    1. Const QUOTE As String = """"
    2.  
    3. MsgBox "<body bgcolor=" & QUOTE & "#FFFFFF" & QUOTE & ">"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width