Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

string "vbcr" make into vbcr to use in vb

Status
Not open for further replies.

YYYYUU

Programmer
Dec 13, 2002
47
GB
I have a string markExists = "vbCrLf" which I want to use in the following:

markExists & "freddy mercury" & markExists

But this displays as

vbCrLffreddymercuryvbCrLf.

How can I make this display as carriage return line feed. Basically making string into vbCrLf constant.
 
I can't I'm reading this from an xml attribute and it reads it as a string
 
I'm not sure bout this, but you can try:

IIF(XMLNode="vbcrlf",vbCrLf,"") & "freddy mercury" & IIF(XMLNode="vbcrlf",vbCrLf,"")

regards
 
Thanks for your help.


I'm actually trying to get away from hardcoding this in. Basically there is a table in Oracle with vbCrLf and xml with this in it is read by vb. I can hardcode in that "vbCrLf" gets replaced by vbCrLf but there will be other similar constants and I don't want to have to hard code these "replaces" in.
 
Sorry, whoever wrote the original record should have used real carriage-return line-feeds, rather than putting in replacement strings like "vbCrLf" and expecting the person reading the file (you) to understand what they meant.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
If (for some strange reason) you do need to change them...

Text = Replace(Text, "vbCrLf", vbCrLf)
Text = Replace(Text, "vbCr", vbCr)
Text = Replace(Text, "vbLf", vbLf)

if you are using this for xml, I would use "/n" instead of "vbCrLf" it will save you a few characters, and is the standard for New line in most other languages...

Then just say:
Text = Replace(Text, "/n", vbCrLf)

Good Luck,
Josh

Have Fun, Be Young... Code BASIC
-Josh
cubee101.gif


PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
Option Explicit

Private Sub Command1_Click()
Dim result As String
Dim MarkExists As String

MarkExists = "vbCrLf"

With CreateObject("MSScriptControl.ScriptControl")
.Language = "vbscript"
result = .Eval(MarkExists & "& ""freddy mercury"" &" & MarkExists)
End With

MsgBox "x" & result & "x" ' Now demonstrate

End Sub
 
Thanks for your replies, very useful indeed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top