问题
In Powerpoint 2011 (Mac), the following code is returning Run-time error '-2147483640 (80000008)': Method 'Export' of object '_Slide' failed
I've tried every variant of this call I could find, this works fine on Windows, and as export appears as a valid method call in Mac VBA should be supported. Can't find any references to the error in Google. So I am stumped as to why this is appearing.
Local variable watcher shows oSld as a valid slide, and sImagePath as a valid file name.
Any insights into what's going here would be gratefully appreciated....
Sub devtests()
Dim oSlides As Slides
Dim sImagePath As String
Dim oSld As Slide
Dim oPres As Presentation
Set oPres = ActivePresentation
Set oSlides = oPres.Slides
sImagePath = "MacSSD:Users:myuserdir:test:"
For Each oSld In oSlides
sImagePath = sImagePath & Format(oSld.SlideIndex, "000") & ".jpg"
Call oSld.Export(sImagePath, "JPG")
'also tried - oSld.Export sImagePath, "JPG"
Next oSld
End Sub
回答1:
I can repro the problem here. I think you've turned up a bug. There are lots of 'em in 2011 VBA + PowerPoint, unfortunately. VBA had to be completely rewritten for this release, as I understand it, and it's always the step-child when it comes to commanding dev resources.
I've reported the problem to some Mac-type people I know at MS. Will let you know if I hear anything useful back from them.
来源:https://stackoverflow.com/questions/8432593/powerpoint-2011-mac-reports-method-export-of-object-slide-failed