Consulting

Results 1 to 4 of 4

Thread: Solved: Vb New Line

  1. #1

    Solved: Vb New Line

    i get a sytax Error with teh following code
    [vba]
    txtQ.Value = "CS_WLR3_AFL_ACTIVITY_QUEUE" & vbNewLine & _
    "Raise as an Activity NOT an enquiry." & vbNewLine & _
    "AREA: Complaint - Compensation" & vbNewLine & _
    "TYPE: Compensation" & vbNewLine & _
    "DETAILS REQUIRED:" & vbNewLine & _
    "telephone number the claim is for:" & vbNewLine & _
    "Date reported:" & vbNewLine & _
    "Date cleared:" & vbNewLine & _
    "# of lines reported:" & vbNewLine & _
    "Survey required Y/N" & vbNewLine & _
    "DRRC/MCA paid ?" & vbNewLine & _
    "Previous relevant faults/claims:" & vbNewLine & _
    "Fault Location:" & vbNewLine & _
    "Name and address for the claim pack." & vbNewLine & _
    [/vba]

    I am trying to add these lines to a textbox any idea why its not working. I have not used VB new line in a long time...

    Edit: Backslash added to tags

  2. #2
    VBAX Tutor
    Joined
    Dec 2006
    Posts
    271
    Location
    Try this

    [VBA]Dim msg As String
    msg = "CS_WLR3_AFL_ACTIVITY_QUEUE" & vbNewLine
    msg = msg & "Raise as an Activity NOT an enquiry." & vbNewLine
    msg = msg & "AREA: Complaint - Compensation" & vbNewLine
    msg = msg & "TYPE: Compensation" & vbNewLine
    msg = msg & "DETAILS REQUIRED:" 'etc

    Me.TextBox1.Value = msg[/VBA]

    remove the & _ after the vbnewline

  3. #3
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    The error is the continuation in your last line of code
    [VBA]"Name and address for the claim pack." & vbNewLine[/VBA]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  4. #4
    lol thanks i guess i got carries away with copy and paste, works fine when i removed the last new vbline

Posting Permissions

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