I am using a MAC and I'm trying to create a macro that will print a Word document from my Excel worksheet. The user does not need to see the word document, they just need to print it.
After looking through some of the previous questions answered in this forum I managed to write some code that worked on my PC at home.
However, I changed the file path and filename and copied the code to my MAC that I am using at work and the code no longer seems to work. I wonder if the code has to be different when using a MAC?
I am using Microsoft Excel for Mac 2011, version 14.6.8.
ans = MsgBox(Prompt:="Document 1", Buttons:=vbYesNo, Title:="Print") If ans = vbYes Then Dim objWord Dim objDoc Set objWord = CreateObject("Word.Application") 'Enter filename and path here Set objDoc = objWord.Documents.Open("/Volumes/.../Document 1.docx") objWord.Visible = False objDoc.PrintOut objWord.Quit End If
Sometimes the code gets stuck at
CreateObject("Word.Application") and sometimes the code get stuck where I have written the file path and filename.
I'm not entirely sure that I have written the file path correctly..?
Any help would be much appreciated.