PDA

View Full Version : MAC EXCEL VBA - open word document



chooriang
12-24-2019, 05:31 PM
I have below piece of late binding code which doesn't work on Excel MAC. I'm trying to copy a word doc then open it.


FileCopy strTemplatePath, strOutputPath

On Error Resume Next
Set wdApp = CreateObject("Word.application")
wdApp.Visible = True
wdApp.WindowState = 2
On Error GoTo 0
DoEvents

Set wdDoc = wdApp.Documents.Open(strOutputPath)

The code successfully copies the strTemplatePath as strOutputPath but fails to open it later on.
The code fails on "Set wdDoc = wdApp.Documents.Open(strOutputPath)", Object variable is not set.

The workbook resides in the Document folder. Disable or Enable document gallery gives no effect.

What is wrong with the code or the MAC??