如何用vb將下圖中的分段英文自動連成一段。
uj5u.com熱心網友回復:
s="abcd........"s=replace(s,vbcrlf,"")
uj5u.com熱心網友回復:
s=replace(s,vbcrlf," ") '使用空格代替回車換行會合適點uj5u.com熱心網友回復:
試了一下 好像不太行 能否費心寫個實作了的完整代碼uj5u.com熱心網友回復:
先把這段文本選中,然后執行代碼。Sub rep()
Dim sText As String
sText = Selection.Text
sText = Replace(sText, vbCr, " ")
Selection.Text = sText
End Sub
uj5u.com熱心網友回復:
strLine = Replace(strLine, vbTab, "") '將tab符替換成""
strLine = Replace(strLine, Chr(0), "") '將行結束符替換成""
strLine = Replace(strlINE, vbCrLf, "") '將回車符替換成""
uj5u.com熱心網友回復:
Sub rep()
Dim s As String
s = "......" '你的多段文本
s = Replace(s, vbCr, " ")
s = Replace(s, vbCrlf, " ")
print s
End Sub
uj5u.com熱心網友回復:
用word一個替換就行了啊,查找替換:查找內容為:^p,替換內容為: ←半角空格然后點全部替換,ok
uj5u.com熱心網友回復:
先存到一個記事本中,C:\1.TXT
'┏〓〓〓〓〓〓〓〓〓 OpenFile,start 〓〓〓〓〓〓〓〓〓┓
'[簡介]:
'打開檔案
Function OpenFile(FileName, Optional ErrInfo As String) As String
'[mycode_id:19],edittime:2012/9/5 19:48:31
On Error GoTo Err1
Dim Fs, TextFile
Set Fs = CreateObject("Scripting.FileSystemObject")
Set TextFile = Fs.OpenTextFile(FileName)
OpenFile = TextFile.ReadAll ' 讀取整個檔案的資訊
Exit Function
Err1:
ErrInfo = Err.Description
End Function
'┗〓〓〓〓〓〓〓〓〓 OpenFile,end 〓〓〓〓〓〓〓〓〓┛
'┏〓〓〓〓〓〓〓〓〓 SaveFile,start 〓〓〓〓〓〓〓〓〓┓
'[詳介]:
'保存時有時會亂碼或變樣
'[簡介]:
'保存字符資訊到文本檔案,保存資料
Function SaveFile(zname, zbody,optional msg as boolean)
'[mycode_id:177],edittime:2011/9/9 15:29:57
On Error GoTo err
Dim myfile, fso
Set fso = CreateObject("Scripting.FileSystemObject")
Set myfile = fso.CreateTextFile(zname, True)
myfile.Write zbody
Set myfile = Nothing
Set fso = Nothing
If msg Then MsgBox "保存成功!" & vbCrLf & zname
Exit Function
err:
'MsgBox err.Description
End Function
'┗〓〓〓〓〓〓〓〓〓 SaveFile,end 〓〓〓〓〓〓〓〓〓┛
SUB TEST
DIM S
S=OPENFILE("C:\1.TXT")
S=REPLACE(S,VBCRLF," ")
SAVEFILE("C:\1.TXT",S)
END SUB
uj5u.com熱心網友回復:
這段英文在什么資料源中?在一個檔案里?一個文本框中?還是在一幅圖片中?
uj5u.com熱心網友回復:
Sub rep()
Dim s As String
s = "......" '你的多段文本
s = Replace(s, vbCr, "")
s = Replace(s, vblf, "")
debug.print "s=["+s+"]"
End Sub
uj5u.com熱心網友回復:
請問vba中吧excel中一個sheet中的2000條資料,向oracle批量insert資料有什么好的方式么? 回圈太慢了感覺。大家有什么好的辦法么?謝謝。。不好意思,沒分了發不了帖子了,借到問問啊。uj5u.com熱心網友回復:
很久沒有關注VB,還是有多年前的老戰友一直在這里奮斗啊,很佩服!轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/142388.html
標籤:VBA
上一篇:VB 隱藏WIN7的開始按鈕
下一篇:我是新手
