简体   繁体   English

Office 365 工作簿。从 SharePoint Online 打开打开空白文件

[英]Office 365 Workbooks.open from SharePoint Online opens blank file

Our company is using Office 365 Pro Plus on Semi-Annual update channel.我们公司正在半年更新频道上使用 Office 365 Pro Plus。 Lately we've been updated from version 1708 to 1803.最近我们已经从版本 1708 更新到 1803。

We are using some automation macros than open files from our SharePoint online tenant.我们正在使用一些自动化宏,而不是从我们的 SharePoint 在线租户打开文件。 Since the update, a call of Workbooks.open(" https://xxxxxx.sharepoint.com/sites/.../xxx.xlsx ") now prompts for an O365 user and password every time, and don't use the one used as Excel account.自更新以来,现在每次调用 Workbooks.open(" https://xxxxxx.sharepoint.com/sites/.../xxx.xlsx ") 都会提示输入 O365 用户和密码,并且不要使用一个用作Excel帐户。

It opens a "blank" workbook (see screenshot) :它打开一个“空白”工作簿(见截图): 在此处输入图片说明

Workbooks.open() on local documents is still working as before, only opening files from SP Online has this problem.本地文档上的 Workbooks.open() 仍然像以前一样工作,只有从 SP Online 打开文件有这个问题。

I tried to switch to monthly channel on a computer, but the problem persists.我尝试在计算机上切换到月度频道,但问题仍然存在。 Opening the file manually using the link is working.使用链接手动打开文件是有效的。

Here is a sample code we're using :这是我们正在使用的示例代码:

Sub Transfert_SST_Copy()

Dim Tbl As ListObject
Dim NewRow As ListRow
Dim Data As ListRow
Dim Wb As Workbook

Set Wb = Workbooks.Open(Filename:="https://xxxxx.sharepoint.com/:x:/r/sites/XXX/AMTB%20RFQ%20costing/00%20General/Overview%20RFQs/Cost%20computations%20simple%20overview/2018%20AMTB_Cost_computations_overview_simple.xlsm?d=w8929b5112ed7496bb25d82b0bfc472c5&csf=1&e=PADrRt", ReadOnly:=False)
' Here Excel opens a "Blank" Workbook, so everything after that is giving an error
Set Tbl = Range("CostCalcOverview").ListObject
Set NewRow = Tbl.ListRows.Add(AlwaysInsert:=True)

NewRow.Range.Offset(0, 1).Resize(1, ThisWorkbook.Worksheets("Transfert").Range("A275:AW275").Count).Value = ThisWorkbook.Worksheets("Transfert").Range("A275:AW275").Value

End Sub

Hi I had the same issue - and it was getting to me as it seemed such an easy thing!嗨,我遇到了同样的问题——这对我来说是件很容易的事情! The problem is with your filename link.问题在于您的文件名链接。

 Set Wb = Workbooks.Open(Filename:="https://xxxxx.sharepoint.com/:x:/r/sites/XXX/AMTB%20RFQ%20costing/00%20General/Overview%20RFQs/Cost%20computations%20simple%20overview/2018%20AMTB_Cost_computations_overview_simple.xlsm?d=w8929b5112ed7496bb25d82b0bfc472c5&csf=1&e=PADrRt", ReadOnly:=False)

The filename link you used is directly from SharePoint when you click "Share" or "Copy link", but what resolved this for me is by actually opening the SharePoint file in Desktop Excel.当您单击“共享”或“复制链接”时,您使用的文件名链接直接来自 SharePoint,但为我解决此问题的是实际在桌面 Excel 中打开 SharePoint 文件。 Then click File.然后单击文件。 You are then shown the "Info" page which shows the File Name - if you look directly below the filename (above where it says "Protect Workbook") there looks to be like breadcrumb links (folder names from SharePoint separated by >>) - click that section and click "Copy path to clipboard"然后,您将看到显示文件名的“信息”页面 - 如果您直接查看文件名下方(上面写着“保护工作簿”),则看起来像面包屑链接(来自 SharePoint 的文件夹名称由 >> 分隔)-单击该部分,然后单击“将路径复制到剪贴板”

Replace your Filename link in your code with this and it will work!用这个替换你代码中的文件名链接,它会起作用!

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM