Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 7 of 7

Thread: Is it Notepad, or me?

  1. #1
    Guest

    Default

    I'm am writing to a text file, called testfile.log through VBA in an excel app (XL2000). I am writing the current Date and Time to the file, and trying to put a carriage return at the end of each entry. I have tried using "vbCR", as well as Chr(13). The thing of it is, when I open the log file in Notepad, I get little rectangle characters were the carriage return is supposed to be. I realize this is an actual carriage return character, but I want it to do a carriage return. I've tried changing the way I open the file, ASCII, Unicode, etc.. that doesn't seem to work either. Also, if I open the log file with wordpad, it looks right. Please help....

  2. #2
    Board Regular Steve Hartman's Avatar
    Join Date
    Feb 2002
    Location
    Houston,Texas
    Posts
    417
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    1. open the file in Wordpad instead of notepad.

    2.In notepad choose FORMAT and click on Word Wrap

  3. #3
    Board Regular
    Join Date
    Feb 2002
    Posts
    97
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    1. I realize that is an option. But, it's a matter of convenience. When the file is double-clicked, it's going to open in Notepad and not Wordpad, and there are going to be numerous people opening this log file.

    2. Word wrap is on.

  4. #4
    Board Regular Steve Hartman's Avatar
    Join Date
    Feb 2002
    Location
    Houston,Texas
    Posts
    417
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Could you post the code you're using to create the log file?

  5. #5
    Board Regular
    Join Date
    Feb 2002
    Posts
    97
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks for your help! I figured it out, I needed to be using vbCrLf instead of just vbCr! Duh..


  6. #6
    Board Regular Steve Hartman's Avatar
    Join Date
    Feb 2002
    Location
    Houston,Texas
    Posts
    417
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I'ld say you're welcome if I'ld done anything to help!

  7. #7
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Austin, Texas USA
    Posts
    11,654
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-03-12 12:36, charlie79 wrote:
    Thanks for your help! I figured it out, I needed to be using vbCrLf instead of just vbCr! Duh..

    [img]/board/images/smiles/icon_smile.gif[/img]
    I wondered about that... using CHAR(10) instead... but, you seemed pretty adament about using CHAR(13).

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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