[英]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.