IgnoreReadOnlyRecommended 在打开 Excel 工作簿时不适用于 Python [英] IgnoreReadOnlyRecommended not working from Python when opening Excel workbook

查看:52
本文介绍了IgnoreReadOnlyRecommended 在打开 Excel 工作簿时不适用于 Python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 excel 工作簿,我需要以可写模式从 python 打开.工作簿设置为提示 只读推荐,并且无法删除.

I have an excel workbook I need to open from python in a writable mode. The workbook is set up to have the prompt for a read only recommendation and this cannot be removed.

我正在使用以下内容:

import win32com.client
xl=win32com.client.Dispatch("Excel.Application")
filepath = 'C:\Users\FullFilePath.xlsm'
xl.Workbooks.Open(Filename=filepath, ReadOnly=False, IgnoreReadOnlyRecommended=True)

它打开了文件,但它仍然弹出对话框,询问我是否想以只读方式打开.可以取消那个对话框吗?

It opens the file, but it's still popping up the dialog asking if I want to open in read only. Is it possible to cancel that dialog?

推荐答案

改用:

xl = win32com.client.DispatchEx('Excel.Application')

这对我来说没有对话框.

This works without a dialog box for me.

这篇关于IgnoreReadOnlyRecommended 在打开 Excel 工作簿时不适用于 Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆