简体   繁体   English

从 Outlook 打开 Excel 时 VBA 只读

[英]VBA Read-only when Opening Excel from Outlook

I tried to open an excel file from Outlook but I can only open it in Read-only mode.我试图从 Outlook 打开一个 excel 文件,但我只能以只读模式打开它。 I wrote this code:我写了这段代码:

strFile = "C:\Users\My File.XLSX"  
Set sourceWB = XLApp.Workbooks.Open(strFile, True, False)

But it didnt work.但它没有用。

I would like to open it in Read mode.我想以阅读模式打开它。

Thank you very much in advance,非常感谢您提前,

Lorenzo洛伦佐

Your syntax is ok.你的语法没问题。 I think the problem is that 'C:\\Users\\' is a System Directory and NTFS restricts to readonly.我认为问题在于 'C:\\Users\\' 是一个系统目录,而 NTFS 限制为只读。 Try putting the file in a different location.尝试将文件放在不同的位置。 for example '%UserProfile%'例如'%UserProfile%'

There is an attribute for read-only.有一个只读属性。 If you set the attribute to vbNormal it should open normally.如果将该属性设置为 vbNormal,它应该会正常打开。 But you have to set it before the file opens.但是你必须在文件打开之前设置它。

SetAttr "C:\Blank.xls", vbNormal

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 停止 ms 访问 VBA 打开 Excel 文件只读 - Stop ms Access VBA opening Excel File Read-only 在没有只读模式的情况下从Outlook打开工作簿 - Opening Workbook from Outlook without read-only mode 如何在使用 VBA 打开 Excel 工作簿时绕过 SharePoint“只读”警报。 - How to bypass SharePoint "Read-Only" alert when opening an Excel Workbook with VBA. 使用文件时 Excel VBA 以只读方式打开 - Excel VBA Open Read-Only when File is in Use 如何从Excel VBA打开只读Word文档 - How to open a Read-only Word Document from Excel VBA 从Excel VBA连接到只读Access数据库 - connecting to a read-only Access db from Excel VBA Excel VBA将数据写入第二个工作簿,但开始打开只读版本,因为“_已经打开 - Excel VBA writes data to second workbook, but starts opening read-only versions because " _ is already open 如何让 PowerShell 抑制只读模式,并在打开 Excel 工作簿时允许编辑? - How to get PowerShell to supress read-only mode, and allow editing when opening Excel workbook? 无论如何,ADO 在保存之前从只读 excel 文件中读取更新的数据? (VBA) - Anyway for ADO to read updated data from a read-only excel file before save? (VBA) Excel VBA宏在勾选了“只读”属性时赋予了对文件的写访问权限 - Excel VBA macro to give Write access to file when Read-only property attribute ticked
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM