By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,725 Members | 1,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,725 IT Pros & Developers. It's quick & easy.

Microsoft Office 2003 Pro - Strange Error at runtime

P: n/a
This error is driving me nuts. The code below will run perfectly when
it has a breakpoint. But as soon as I remove the breakpoint and run it
normally outside of debug mode I get a strange error message that says:

"Microsoft Office PowerPoint has encountered a problem and needs to
close. We are sorry for the inconvience.

If you were in the middle of something, the information you were
working on might be lost."

If any one can help with this I really would appreciate. Here is the
code:
Function CreatePowerPointCatiaImage(vbFilePath As String)
Dim ppApp As PowerPoint.Application
Dim mySlide As PowerPoint.Slide
Dim mytShape As PowerPoint.Shape
Dim shpCurrShape As PowerPoint.Shape
Dim myDocWin As PowerPoint.DocumentWindow
Dim myPicture As String
Dim path As String
Dim vbFilePath2 As String
Dim prsPres As PowerPoint.Presentation
Dim IStartedppApp As Boolean

vbFilePath2 = "c:\winnt\temp\CatiaImage.ppt"

' Noice the extra slashes
If ppApp Is Nothing Then
Set ppApp = New PowerPoint.Application
IStartedppApp = True
End If

'ppApp.Activate 'this flashes powerpoint onscreen can't hide it per
vberror
With ppApp
Set prsPres = .Presentations.Add(msoTrue)
With prsPres
Set mySlide = .Slides.Add(.Slides.Count + 1, ppLayoutBlank)
With mySlide
mySlide.Shapes.AddPicture vbFilePath, msoFalse, msoTrue,
50, 30, 600, 480
End With
' With ppApp 'must use Activate as shown above
' ppApp.ActiveWindow.ViewType = ppViewSlide
' End With
If FileExists(vbFilePath2) Then
Kill (vbFilePath2)
End If
prsPres.SaveCopyAs vbFilePath2

'ppApp.Quit 'Quit PowerPoint - if you have a command after it will not

End With
End With

If IStartedppApp Then ppApp.Quit
Set ppApp = Nothing
Set mySlide = Nothing
Set mytShape = Nothing
Set shpCurrShape = Nothing
Set myDocWin = Nothing


End Function

Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Don't see an obvious error. Make sure you actually run 'Compile' from the
menu rather than just closing.

Darryl Kerkeslager
<so**********@netzero.net> wrote in message
news:11*********************@c13g2000cwb.googlegro ups.com...
This error is driving me nuts. The code below will run perfectly when
it has a breakpoint. But as soon as I remove the breakpoint and run it
normally outside of debug mode I get a strange error message that says:

"Microsoft Office PowerPoint has encountered a problem and needs to
close. We are sorry for the inconvience.

If you were in the middle of something, the information you were
working on might be lost."

If any one can help with this I really would appreciate. Here is the
code:
Function CreatePowerPointCatiaImage(vbFilePath As String)
Dim ppApp As PowerPoint.Application
Dim mySlide As PowerPoint.Slide
Dim mytShape As PowerPoint.Shape
Dim shpCurrShape As PowerPoint.Shape
Dim myDocWin As PowerPoint.DocumentWindow
Dim myPicture As String
Dim path As String
Dim vbFilePath2 As String
Dim prsPres As PowerPoint.Presentation
Dim IStartedppApp As Boolean

vbFilePath2 = "c:\winnt\temp\CatiaImage.ppt"

' Noice the extra slashes
If ppApp Is Nothing Then
Set ppApp = New PowerPoint.Application
IStartedppApp = True
End If

'ppApp.Activate 'this flashes powerpoint onscreen can't hide it per
vberror
With ppApp
Set prsPres = .Presentations.Add(msoTrue)
With prsPres
Set mySlide = .Slides.Add(.Slides.Count + 1, ppLayoutBlank)
With mySlide
mySlide.Shapes.AddPicture vbFilePath, msoFalse, msoTrue,
50, 30, 600, 480
End With
' With ppApp 'must use Activate as shown above
' ppApp.ActiveWindow.ViewType = ppViewSlide
' End With
If FileExists(vbFilePath2) Then
Kill (vbFilePath2)
End If
prsPres.SaveCopyAs vbFilePath2

'ppApp.Quit 'Quit PowerPoint - if you have a command after it will not

End With
End With

If IStartedppApp Then ppApp.Quit
Set ppApp = Nothing
Set mySlide = Nothing
Set mytShape = Nothing
Set shpCurrShape = Nothing
Set myDocWin = Nothing


End Function

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.