0
我得到消息如何通過VBA宏在讀取中寫入更多文字並將文本寫入文檔?
- 打開讀取可用 當我需要打開在讀寫模式下的文檔,和之前的宏的文檔關閉僅
- 本地副本
- 收到通知執行
而且我ahve在路上懷疑我寫的文字
Sub Read_Write_Document()
Dim p As Long, r As Long
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
Set wrdDoc = wrdApp.Documents.Open("C:\Documents and Settings\Desktop\Word_File_read_write_1.docx")
Dim i As Integer
i = 1
With wrdDoc_Read
For p = 1 To .Paragraphs.Count
Set tRange = .Range(Start:=.Paragraphs(p).Range.Start, End:=.Paragraphs(p).Range.End)
tString = tRange.Text
tString = Left(tString, Len(tString) - 1)
If InStr(1, tString, "1") > 0 Then
If Mid(tString, 1, 4) = "date" Then
tRange.Text = "DATE" ' Write Text
End If
End If
Next p
End With
.SaveAs ("C:\Documents and Settings\Desktop\Word_File_read_write_2.docx")
wrdApp.Quit ' close the Word application
Set wrdDoc = Nothing
Set wrdApp = Nothing
End Sub