LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Writing File in VBA with Unix line break

Using Mac, OS X 10.3.9, Excel X for Mac.

I need to write a text file in VBA with a Unix line break (ASCII 10 / x0A).
I'm iterating over a range of cells and writing out lines with:

Print #FileNum, Cell.Text & Chr(10)

Anyway, when I get my file written out, it's not performing as I expected. I
did a hex dump with TextWrangler and found that I'm not getting a linefeed
character written out. Here's a sample hex line:

0050: 00 0D 00 0D 00 64 00 69 00 67 00 20 00 31 00 39 .....d.i.g. .1.9

The first two characters should be a single line feed (x0A), but I'm getting
a double carriage return (x00 x0D).

Two questions:
1. It looks like Excel is putting out double-byte ASCII (all the extra 00 in
front of the actual ASCII characters). Is this correct?

2. Why am I getting ASCII 13 / x0D when I'm explicitly writing out ASCII 10
/ x0A?
-------------------

P.S. I discovered that some common Mac VBA constants are not as expected:
vbCr 13
vbCrLf 13
vbFormFeed 12
vbLf 13
vbNewLine 13
vbNullChar 0
vbObjectError 45
vbTab 9

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I create a line break writing text within a cell? Shel Excel Discussion (Misc queries) 1 December 11th 08 12:19 AM
Break cell into multiple lines by line break Chia Excel Discussion (Misc queries) 1 August 20th 06 06:37 AM
Writing a line in to a file Sridhar P via OfficeKB.com Excel Programming 3 October 19th 05 04:46 PM
read a Unix binary file Arnaud Boëlle Excel Programming 2 April 20th 05 09:24 PM
Unix Directory/File Listing enchilada Excel Programming 0 December 10th 03 07:46 AM


All times are GMT +1. The time now is 07:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"