0
votes

I am trying to use this code with a button to open a word doc in excel 2106 on a mac running high sierra:

Sub buttontest1()
Dim objdoc As Object

FileName = "/Volumes/256SSD/word docs/shortcut keys.docx"

With CreateObject("word.application")

Set objdoc = .documents.open(FileName)
End With

Set objdoc = Nothing
End Sub

The first time I run this, it works fine. I then close the word doc (command q) and run it again but I get a runtime error -2146959355 (80080005) and a blank word doc opens. I click "End" in the runtime error box and quit the word doc and run the code again and the word doc opens correctly. I quit the doc and run again and get the run time error.

Can someone help please?

PS I have tried using : instead of / in the file path but that gives a different error

1

1 Answers