具體來說,它會輸入起始和結束行號,然後從Excel表中提取每壹行的數據。接下來,它復制壹個文檔並在文件名後添加當前行的數據。然後,它將打開這個新文檔,用'替換文檔中的指定文本。選擇。查找對象,並保存文檔。
這段代碼有些問題。例如,它定義了壹些常量和變量,但並不使用它們。此外,它會在使用後打開壹個Word應用程序而不關閉它,這可能會導致內存泄漏。
如果妳想繼續使用這段代碼,建議妳先清除不用的常量和變量,用完後關閉Word應用程序,避免內存泄露。
子單詞examination_Click()
const str remote _ path 1 = " C:\ other \ A \ "
const str remote _ filename 1 = " word "
const str remote _ path 2 = " C:\ other \ B \ "
Dim單詞檢查作為新單詞檢查。應用
Dim i,j
str remote _ path 1 = this workbook。小路
B = InputBox("我不確定","我不確定")
C = InputBox(“梾椡壯壯壯", "僩壯")
邯鄲= 0
對於i = B到c
strRemote_FileName1 = "AAA "
file copy str remote _ path 1 & amp;" \AAA.doc ",str remote _ path 1 & amp;" \ " & ampstr remote _ filename 1 & amp;"(" & amp紙張(“BBB”)。範圍(" c " & ampI)和amp").doc "
strRemote _ path 2 = strRemote _ path 1 & amp;" \ " & ampstr remote _ filename 1 & amp;"(" & amp紙張(“BBB”)。範圍(" c " & ampI)和amp").doc "
用單詞檢查
. Documents.Open strRemote_Path2
。可見=假
用. Selection.Find
對於x = 7到1步長-1
str 1 = " 100 " & amp;格式(x,“000”)
Str2 =紙張(“BBB”)。單元格(I,x)
。Text = Str1
. Replacement.Text = Str2
。執行替換:=wdReplaceAll
下壹個x
以…結尾
.選擇.整個故事
. selection . font . color = wdcolor automatic
以…結尾
措辭檢查。文檔.保存
接下來我
措辭檢查。放棄
設置Wordexamination = Nothing
如果邯鄲= 0那麽
I = MsgBox ("I?單詞復習”,0+48+256+0,“采納”)
如果…就會結束
末端接頭