我还没有找到任何可以帮到我的东西。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