English 中文(简体)
VBA Power Point言行错误——2147467259(80004005):陈述。 近距离:失败
原标题:VBA PowerPoint Run-time error -2147467259 (80004005): Presentation.Close: Failed

I have a macro which is running from Excel. This macro opens PowerPoint slides, performs some work, and then closes them. The problem I am having is the following:

“eror”/

这一错误信息似乎在整个宏观运行期间随机出现。 这一错误不能与保持一致,而且似乎随着时间的推移(基于某些种族条件),该行似乎还会随意操作。

造成这一错误的具体法典如下:

myPresentation.Close
问题回答

我测试的情况:

myPresentation.saved=true
myPresentation.Close

哪一问题没有解决

myPresentation.saved=true
myPresentation.windows(1).activate
myPresentation.Close

也没有工作。 最后,我提出的最稳定的解决办法如下:

 This function is implemented as a fix for an issue where VBA reports "Presentation.Close: Failed"
 @param pres as Object<PowerPoint.Presentation> - The presentation to close.
 @docs https://stackoverflow.com/questions/78156015/vba-powerpoint-run-time-error-2147467259-80004005-presentation-close-fail/78156016#78156016
Public Sub ClosePresentation(ByVal pres As Object)
  pres.windows(1).Activate
  While Not pres.Saved
    pres.Saved = True
  Wend
  stdWindow.CreateFromApplication(pres.Application).Quit
End Sub

该图书馆使用stdWindow,这是一个开放源图书馆。 归根结底,这意味着间接向窗口发出的近距离信息(通过Windows AP)似乎更为稳定,因为我认为,这正是用户通常如何关闭窗口。

必须指出,所挽救的环境似乎具有某些种族条件,因此也存在漏洞。





相关问题
import of excel in SQL imports NULL lines

I have a stored procedure that imports differently formatted workbooks into a database table, does work on them then drops the table. Here is the populating query. SELECT IDENTITY(INT,1,1) AS ID ...

Connecting to Oracle 10g with ODBC from Excel VBA

The following code works. the connection opens fine but recordset.recordCount always returns -1 when there is data in the table. ANd If I try to call any methods/properties on recordset it crashes ...

Excel date to Unix timestamp

Does anyone know how to convert an Excel date to a correct Unix timestamp?

C# GemBox Excel Import Error

I am trying to import an excel file into a data table using GemBox and I keep getting this error: Invalid data value when extracting to DataTable at SourceRowIndex: 1, and SourceColumnIndex: 1. As ...

Importing from excel "applications" using SSIS

I am looking for any tips or resources on importing from excel into a SQL database, but specifically when the information is NOT in column and row format. I am currently doing some pre-development ...

热门标签