【问题标题】:What is the reason that my Macro Made PowerPoint is Showing Error "Upload Blocked" After Completing Macro via Excel?通过 Excel 完成宏后,我的 Macro Made PowerPoint 显示错误“上传被阻止”是什么原因?
【发布时间】:2022-10-04 22:02:55
【问题描述】:

首先,我想首先声明我知道这不是最实用的方法,但我已经尝试了 100 个其他示例,但没有任何效果。我最初通过 Excel VBA 刷新 PPT 链接的目标没有成功。对于一些背景信息,我的老板有一个 Excel 电子表格,他在上面有我们的项目状态。我通过 PowerPoint 在电视显示器上使用 Raspberry Pi 显示它。我在 Excel 中创建了一个宏按钮,当他在向电子表格中添加更多内容后点击“刷新”宏按钮时,它将自动更新 PowerPoint。一切都很顺利,除了刷新后我重新打开 PowerPoint 时,我看到的是:

现在,对于我的代码。

子 CopyRangeToPowerPoint()

'Declare PowerPoint Variables

Dim PP As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide

Dim SlideTitle As String

Dim exlRange As Range
Dim filePath As String

'Opening PowerPoint and Creating a new Presentation

Set PP = CreateObject("PowerPoint.Application")
Set PPPres = PP.Presentations.Add

'PP.ActiveWindow.WindowState = ppWindowMinimized


'Defining the path
filePath = ("PathToFile\TV Display PowerPoint.pptx")

PP.DisplayAlerts = ppAlertsNone

'Adding a new slide in PowerPoint Presentation and selecting that slide for further use
For i = PPPres.Slides.Count To 1 Step -1
    Set PPSlide = PPPres.Slides(i)
    PPSlide.Delete
Next i


Set PPSlide = PPPres.Slides.Add(1, ppLayoutLargeObject)
PPSlide.Select

Set exlRange = Range("A1:H45")

exlRange.Copy

PPSlide.Shapes.Paste


PP.ActiveWindow.Selection.ShapeRange.Align msoAlignCenters, True



PP.Activate
PPPres.SaveAs (filePath)


'PP.ActiveWindow.WindowState = ppWindowMaximized
PPPres.Close
PP.Quit


Set PPSlide = Nothing
Set PPPres = Nothing
Set PP = Nothing

结束子

我有一种感觉,这与我想继续保存在同一条路径上但我需要它位于同一位置这一事实有关。任何想法或建议都非常感谢!我是一名实习生,很想给人留下好印象:)

【问题讨论】:

  • 关于 Upload Blocked 的 PPT 咆哮表明您正在将文件保存到云中。或者更确切地说,您的老板正在点击刷新按钮并运行您的宏。但目前尚不清楚是谁打开文件并随后收到错误消息,是你还是老板。可能是您正在使用的文件的权限问题,或者当您尝试使用它时它在其他人的计算机上打开?
  • 我将它保存到云中,以便公司中的每个人都可以访问,也许这不是必需的?之后我是收到错误消息的人,而不是我的老板。该文件未打开,它是我的文件,所以它不应该是权限问题。
  • 我假设您正在从云端打开文件;那是对的吗?如果您将其下载到本地硬盘驱动器并从那里打开它会发生什么?在打开它之前,右键单击,选择属性并查看文件是否被阻止;如果是这样,请取消阻止,然后尝试打开它。我想知道微软新的更严格的政策是否与网络有关。
  • @SteveRindsberg 是的,我也是从云端打开的。可能是我没有给 PPT 足够的时间在退出之前完成这些步骤吗?也许我需要让它睡觉可以这么说。因为我注意到它并非每次都发生,只是有时。这让我相信这不是文件被阻止的问题。
  • >> 这让我相信这不是文件被阻止的问题。尽管错误消息说它是?再次,按照我之前的建议,尝试通过将云排除在外来隔离问题。

标签: excel vba powerpoint


【解决方案1】:

这是解决我的问题的代码。我相信我之前保存它的方式导致了这个“上传被阻止”错误消息。

Sub CopyRangeToPowerPoint()



'Declare PowerPoint Variables

Dim PP As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide

Dim SlideTitle As String

Dim exlRange As Range
Dim filePath As String

'Opening PowerPoint and Creating a new Presentation

Set PP = CreateObject("PowerPoint.Application")

With Application
    .ScreenUpdating = False
    .Calculation = xlManual

End With


Set PPPres = PP.Presentations.Open("PATH TO FILE")
PP.DisplayAlerts = ppAlertsNone
'PP.ActiveWindow.WindowState = ppWindowMinimized





'Deleting current slide 
For i = PPPres.Slides.Count To 1 Step -1
    Set PPSlide = PPPres.Slides(i)
    PPSlide.Delete
Next i


Set PPSlide = PPPres.Slides.Add(1, ppLayoutLargeObject)
PPSlide.Select

Set exlRange = Range("A1:H45")

exlRange.Copy

PPSlide.Shapes.Paste


PP.ActiveWindow.Selection.ShapeRange.Align msoAlignCenters, True



PP.Activate



    With Application

    .Calculation = xlAutomatic
    .ScreenUpdating = True
End With

PPPres.Save
PPPres.Close
PP.Quit


Set PPSlide = Nothing
Set PPPres = Nothing
Set PP = Nothing



End Sub

【讨论】:

    猜你喜欢
    • 2016-05-01
    • 2011-01-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-15
    • 1970-01-01
    • 2012-01-11
    • 1970-01-01
    相关资源
    最近更新 更多