I made a simple shortcut program which basically converts a *.docx file into a pdf and then uploads it to a website. Here's how the conversion is executed:
import win32com.client
outputFilePath = os.path.dirname(os.path.realpath(__file__)) + "\\pdf\\" + fileName + ".pdf"
word = win32com.client.Dispatch('Word.Application')
doc = word.Documents.Open(filePath)
doc.SaveAs(outputFilePath, FileFormat = 17)
doc.Close()
word.Quit()
After compiling the code into an executable file, it works perfectly fine on the machine I've written this on and on my laptop as well. However, I need this to work on another computer which when attempts to run this script, displays the following message instead:
File "<COMObject Open>", line 8, in SaveAs
pywintypes.com_error: (-2147352567, 'Eccezione.', (0, 'Microsoft Word', 'Comando fallito', 'C:\\Program Files (x86)\\Microsoft Office\\Office12\\1040\\WDMAIN11.CHM', 36966, -2146824090), None)
What might be causing this?