2

I tried below code but it is giving me win32com Import Error

import win32com
word = win32com.Dispatch("Word.application")

import glob, os
os.chdir(%doc folder path%)
for file in glob.glob("*.doc"):
    file=%doc folder path%+'\\'+file
    print(file)
    doc = word.Documents.Open(file)
    file = file.replace('.doc','.docx')
    file = file.replace('DOCX_F', 'docx_files')
    doc.SaveAs(file, 16)
word.Quit()

But when I tried to install the same module it is not available

1 Answer 1

1

Try win32com.client instead of just win32com

import win32com.client
word = win32com.client.Dispatch("Word.application")
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.