PDA

View Full Version : How to open a specific word document in Excel VBA



Jamiche12
11-24-2016, 12:28 PM
hello everyone,

I looked everywhere but did not succeed to find a macro (for mac) who find and open a word document.
All the macros I found were leading me to an error message except this one but it is to open a new document :
Do you have an idea ?
Sub TestingMacAndWin()
Dim appWD As Object
Dim wddoc As Object

On Error Resume Next
Set appWD = GetObject(, "Word.application") 'gives error 429 if Word is not open
If Err = 429 Then
Set appWD = CreateObject("Word.application") 'creates a Word application
Err.Clear
End If

Set wddoc = appWD.Documents.Add
appWD.Visible = True