Carriage Return Character Displays as Vertical Bar

Q113267


The information in this article applies to:


SYMPTOMS

In Microsoft Project, when you create a macro that adds a note to a task, if you use the carriage return character (character code 13) to add a new line to the note, the following problems occur:


WORKAROUND

When you use a macro to add a note to a task, and you want the note to contain multiple lines of information, use the line feed character (character code 10), as in the following example:


   Sub Enter_Notes()
         Dim T As String
         T = "ENTER" & Chr(10) & "MORE" & Chr(10) & "NOTES"
         Projects(1).Tasks(1).Notes = T
   End Sub 
Microsoft provides examples of Visual Basic procedures for illustration only, without warranty either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. This Visual Basic procedure is provided 'as is' and Microsoft does not guarantee that it can be used in all situations. Microsoft does not support modifications of this procedure to suit customer requirements for a particular purpose. Note that a line that is preceded by an apostrophe introduces a comment in the code--comments are provided to explain what the code is doing at a particular point in the procedure. Note also that an underscore character (_) indicates that code continues from one line to the next. You can type lines that contain this character as one logical line or you can divide the lines of code and include the line continuation character.

Steps to Reproduce Behavior

  1. In a new project, choose Macro from the Tools menu. Choose the New button. In the Macro Name box, type Enter_Notes. Choose the Options button, and under Store Macro In, select the Current Project File option and choose OK.


  2. In the new macro, enter the following:


  3. 
          Sub Enter_Notes()
             Dim T As String
             T = "ENTER" & Chr(13) & "MORE" & Chr(13) & "NOTES"
             Projects(1).Tasks(1).Notes = T
       End Sub 
  4. From the View menu, choose Gantt Chart.


  5. In the Task Name field in row 1, enter a task, T1. Select T1.


  6. From the Tools menu, choose Macros. From the Macro Name list, select Enter_Notes, and choose Run.


  7. Select Task1, and choose Task Information from the Insert menu. Select the Notes tab.


Note that the character following the words ENTER and MORE is a vertical bar.


STATUS

Microsoft has confirmed this to be a problem in the Microsoft products that are listed at the beginning of this article.


REFERENCES

For more information about the & Operator, choose the Search button in the Visual Basic Reference and type:

& (operator)
For more information about the Chr Function, choose the Search button in the Visual Basic Reference and type:
Chr

Additional query words: cr lf

Keywords :
Issue type : kbbug
Technology : kbHWMAC kbOSMAC kbProjectSearch kbProject400Mac kbProjectMacSearch kbProject400


Last Reviewed: November 5, 2000
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.