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

Thread: creating a TEXT FILE

  1. #1
    Board Regular
    Join Date
    Mar 2002
    Location
    Sydney/Brisbane , Australia
    Posts
    542
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    i have created an excel program and am trying to create an interace which links it to a unix system via a text file.

    I know the text to go into the text file...

    but dont know how to generate a text file from within excel.

    any ideas?

    [ This Message was edited by: Qroozn on 2002-04-23 18:35 ]

  2. #2
    MrExcel MVP Mark O'Brien's Avatar
    Join Date
    Feb 2002
    Location
    Columbus, OH, USA
    Posts
    3,530
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I pulled this from VBA help for the "Write" command. Also have a look for "OpenAsTextStream" and "OpenTextFile". This should get you started. Also, offhand, I know that you may run into problems since UNIX textfiles don't use carriage returns to end a line. (can't remember what though.

    This example uses the Write # statement to write raw data to a sequential file.

    Open "TESTFILE" For Output As #1 ' Open file for output.
    Write #1, "Hello World", 234 ' Write comma-delimited data.
    Write #1, ' Write blank line.

    Dim MyBool, MyDate, MyNull, MyError
    ' Assign Boolean, Date, Null, and Error values.
    MyBool = False : MyDate = #February 12, 1969# : MyNull = Null
    MyError = CVErr(32767)
    ' Boolean data is written as #TRUE# or #FALSE#. Date literals are
    ' written in universal date format, for example, #1994-07-13#
    'represents July 13, 1994. Null data is written as #NULL#.
    ' Error data is written as #ERROR errorcode#.
    Write #1, MyBool ; " is a Boolean value"
    Write #1, MyDate ; " is a date"
    Write #1, MyNull ; " is a null value"
    Write #1, MyError ; " is an error value"
    Close #1 ' Close file.




  3. #3
    Board Regular
    Join Date
    Mar 2002
    Location
    Sydney/Brisbane , Australia
    Posts
    542
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thnks heaps.
    I'll need to muck around with it.

    I'm sure the bosses will sh!t their pants when they see what their Manufacturing trainee has managed to do.

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
  •