我還沒有找到任何可以幫到我的東西。Excel宏 - 打開特定的word文件
我試圖打開某個文件,將一些數據寫入並保存在不同的名稱下。這是我到目前爲止:
Dim appWD As Word.Application
Set appWD = CreateObject("Word.Application.8")
Set appWD = New Word.Application
Dim docWD As Word.Document
Set docWD = appWD.Documents.Open("C:\Documents and Settings\Excel macro\Standaard.docx")
appWD.Visible = True
'
' Data is selected and copied into "Design"
'
Copy all data from Design
Sheets("Design").Select
Range("A1:G50").Copy
' Tell Word to create a new document
appWD.Documents.Add
' Tell Word to paste the contents of the clipboard into the new document
appWD.Selection.Paste
' Save the new document with a sequential file name
Sheets("Sheet1").Select
appWD.ActiveDocument.SaveAs Filename:=ThisWorkbook.Path & "/" & "TEST" & Range("C8").Text
' Close this new word document
appWD.ActiveDocument.Close
' Close the Word application
appWD.Quit
目前它所做的只是;打開Standaard.docx文件,打開一個新文件並將所有內容粘貼到新文件中並保存。它應該打開Standaard.docx文件,將其粘貼到那裏並以新名稱保存。
非常感謝!
Wo rks精彩!非常感謝你 – CustomX 2011-03-15 11:40:33