Excel2007からWord2007に比較的簡単なコピーと貼り付けを行おうとしています。このサイトや他のサイトを調べて、同じことに夢中になっています。以下のコードの3行目で「ユーザータイプのメモが定義されました」エラーメッセージ。私はこれを別のソリューションから持ち上げたばかりなので、本当に混乱しています(そして、持ち上げようとした他のソリューションでも同様の問題がありました)。誰かがエラーの原因とその理由について教えてくれませんか?
Sub ControlWord()
' **** The line below gives me the error ****
Dim appWD As Word.Application
' Create a new instance of Word & make it visible
Set appWD = CreateObject("Word.Application.12")
appWD.Visible = True
'Find the last row with data in the spreadsheet
FinalRow = Range("A9999").End(xlUp).Row
For i = 1 To FinalRow
' Copy the current row
Worksheets("Sheet1").Rows(i).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
appWD.ActiveDocument.SaveAs Filename:="File" & i
' Close this new word document
appWD.ActiveDocument.Close
Next i
' Close the Word application
appWD.Quit
End Sub