You have to declare your variable as Object
like below:
Dim Paragraphe As Object, WordApp As Object, WordDoc As Object
And to use the doc:
File= "D:path"
'Word session creation
Set WordApp = CreateObject("Word.Application")
'word will be closed while running
WordApp.Visible = False
'open the .doc file
Set WordDoc = WordApp.Documents.Open(File)
And to close the application:
WordDoc.Close
WordApp.Quit
Set WordDoc = Nothing
Set WordApp = Nothing
I hope it can help you.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…