簡體   English   中英

PowerPoint 2016 圖表在 VBA 更新后丟失數據表

[英]PowerPoint 2016 chart loses data sheet after VBA update

使用 VBA 在 PowerPoint 2016 中更新 Powerpoint(不是嵌入式 Excel 圖表)后,當我右鍵單擊圖表並選擇編輯數據時,圖表不再允許編輯數據。 如果我選擇圖表上方 rHS 上的過濾器符號,則會出現此錯誤。

鏈接文件不可用於編輯鏈接。 單擊下面文件的編輯鏈接。

單擊超鏈接后,它什么也不做。

這是用於更新圖表的代碼

For Each oSH In ActivePresentation.Slides(2).Shapes

                oSH.Chart.SeriesCollection(1).values = "Sheet1!$B$1:$B" & maxrow  ' change the series range before opening and closing the workbook object
                oSH.Chart.SeriesCollection(1).XValues = "Sheet1!$A$1:$A" & maxrow  'max number showing is 6 data points

                    With oSH.Chart.ChartData

                            'this updates the values in the datasheet
                            .Workbook.sheets(1).Range("A1:B" & lrow - 2).Value = xlWorkBook.sheets(2).Range("A3:B" & lrow).Value

                    End With

經過幾天的搜索和試驗,我找到了解決問題的方法。 我沒有創建幻燈片或圖表,而是發現數據位於數據表的表格中。 我在 Excel 工作表中編輯了數據並將表格轉換為一個范圍。

奇怪的是,這解決了我的問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM