excel vba - How to identify a hidden carriage return character in a UNIX text file over VBA? -
i have application written in excel/vba reads text files written in unix. these files consist in finite element modeling simulation settings, each line in 20k+ text file individual setting. application searches particular setting , returns them user in plain english. particular line this:
model.settings.excitation.modes=50
so far, line of code worked find text between '=' sign , end of line
instr(1, filecontents, vblf)
where filecontents whole text file after '=' symbol.
something somewhere upstream of application has changed assumed carriage return character 'vblf' cannot found, there when viewing in notepad++. application depends on finding carriage return, , doesn't work.
i have tried using :
asc(mid(adsfilecontentsx, 3, 1))
to isolate carriage return character end character next line, doesn't work either.
i tried of below well
instr(1, filecontents, vblf) instr(1, filecontents, vbcrlf) instr(1, filecontents, vbcr) instr(1, filecontents, vbnewline) instr(1, filecontents, chr(10)) instr(1, filecontents, chr(13))
but none of these found carriage return character.
any suggestions on how identify carriage return character being used in textfile?
*edited include have tried
you can test either ascii10 or ascii13:
sub hskdjfh() v = range("a1").value if instr(1, v, chr(10)) > 0 or instr(1, v, chr(13)) > 0 msgbox "got return" else msgbox "no return" end if end sub
edit#1:
here 1 way determine in cell:
sub whatsinthere() dim s string, l long dim msg string, long msg = "" s = range("a1").text l = len(s) = 1 l msg = msg & vbcrlf & & vbtab & mid(s, i, 1) & vbtab & ascw(mid(s, i, 1)) next msgbox msg end sub
in case placed alt+enter after i in cell a1:
Comments
Post a Comment