How to write invisible characters into a text file?

Edward1981

New Member
Joined
Dec 30, 2009
Messages
2
I'm going to convert a ASCII text file into a EBCDIC text file.
The convertion can't be achieved by FTP, because the ASCII text file includes both SBCS and DBCS and I want to leave those DBCS unconverted.
I failed to write EBCDIC characters(invisible in ASCII coding) into file.
Here is my vba code, &HC1 stands for character 'A' in EBCDIC

Public Sub test()
strTemp = ChrB(Val("&HC1"))

fileThis = "D:\workshop\test.txt"
On Error Resume Next
Kill (fileThis)
On Error GoTo 0

Open fileThis For Output As #1
Print #1, strTemp
Close #1
End Sub

After execution, test.txt file only contains a CRLF.
This code can work with visible character,eg &H41. How can I write invisible character into file? Thanks.
 
Last edited:

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Thanks to Richard Schollar.
I can't figure it out using unicode.

I've found out a freak solution at last:
If the character I'm writing is greater than 124 in value, I'll write it together with the next character.For example: Chr(Val("&HC1C1")), which stands for "AA" in EBCDIC.
Previous code works well with character whic is less than 124.

I guess there may be some validation in & funcion.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,965
Messages
6,122,499
Members
449,089
Latest member
Raviguru

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top