|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub lss()
Dim mDoc As Word.Document
Dim wordApp As Word.Application
Set wordApp = GetObject(, "Word.Application")
Set mDoc = wordApp.ActiveDocument
Dim tt As Word.Table
On Error Resume Next
nn = mDoc.Tables.Count
''
For ii = 1 To nn
With mDoc.Tables(ii)
For kk1 = 1 To .Range.Rows.Count
For kk2 = 1 To .Range.Columns.Count
'Debug.Print .Style, .AutoFormatType, .Range.Columns.Count, .Range.Rows.Count, .NestingLevel, .ID
'ThisWorkbook.Sheets("Sheet1").Cells(kk1, kk2) = .Cell("Row:=" & kk1, "Column:=" & kk2).Range.Text
ThisWorkbook.Sheets("Sheet1").Cells(kk1, kk2) = Left(.Cell(kk1, kk2).Range.Text, Len(.Cell(kk1, kk2).Range.Text) - 1)
Next kk2
Next kk1
End With
Next ii
End Sub
ThisWorkbook.Sheets("Sheet1").Cells(kk1, kk2) = .Cell("Row:=" & kk1, "Column:=" & kk2).Range.Text
这个字符串尾部就会有""
现在的解决方法是len的方法来去掉尾部的""
ThisWorkbook.Sheets("Sheet1").Cells(kk1, kk2) = Left(.Cell(kk1, kk2).Range.Text, Len(.Cell(kk1,
还有一种方法
Range("k" & r) = Replace(.Cell(4, 4).Range.Text, vbCr & "", "")
问各位大侠的问题是 vbCr & "",是什么意思???? |
|