替换功能忽略VbCrLF [英] Replace Function ignores VbCrLF

查看:69
本文介绍了替换功能忽略VbCrLF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目中包含以下代码行:

I have the following line of code in my project:

textline = Replace(textline, vbCrLf, "")



重点是从文本行字符串中删除vbCrLf.出于某种原因,Replace函数忽略了vbCrlfs并将其留在其中.只是想知道是否有人知道我在做错什么以及如何解决它.

我也尝试过:



The point is to remove the vbCrLf from the textline string. For some reason the Replace function is ignoring the vbCrlfs and just leaving them in. Just wondering if anybody knows what I''m doing wrong and how to fix it.

I also tried:

textline = Replace(textline, Chr(13), "")
textline = Replace(textline, Chr(10), "")



那也不起作用.有什么想法吗?

在此先感谢您.



That didn''t work either. Any ideas?

Thanks in advance.

推荐答案

以下代码对我有用

Below code works for me

Sub ReplaceString()

Dim textline As String

textline = "ASSDFSDF" + vbNewLine + "sdfsd"
'textline = "ASSDFSDF" + vbCrLf + "sdfsd"
textline = Replace(textline, vbCrLf, "")

MsgBox (textline)

End Sub


这篇关于替换功能忽略VbCrLF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆