Hallo,
ich möchte aus Dem Activen Fenster DMU Navigator(unter Windows) das Bild in Power Point einfügen,
bekomme ber leider immer eine Fehlermeldung beim einfügen des Bildes in PP.(an der stelle Fett dargestellt)
Vielleicht hat jemnd Idee wo ich das Fehler habe.
Vielen Dank
Sub CATMain()
PptInsertPicture
End Sub
Sub PptInsertPicture ( )
Dim TempPfad
TempPfad = "D:\test\"
Dim fso
Set fso = CreateObject ( "Scripting.FileSystemObject")
Dim Dateiname
Dateiname = fso.GetTempName ( )
TempPfad = TempPfad+Dateiname+".bmp"
Dim viewer3D1 As Viewer
Set viewer3D1 = CATIA.ActiveWindow.ActiveViewer
Dim viewpoint3D1 As Viewpoint3D
Set viewpoint3D1 = viewer3D1.Viewpoint3D
On Error Resume Next
Dim Window1
Set Window1 = CATIA.ActiveWindow
Dim WindowLayout1
WindowLayout1 = Window1.Layout
Window1.Layout = catWindowGeomOnly
CATIA.StartCommand "CompassDisplayOff"
On Error GoTo 0
Dim Color (2)
Viewer3D1.GetBackgroundColor color
Viewer3D1.PutBackgroundColor Array (1, 1, 1)
Viewer3D1.Update
Viewer3D1.CaptureToFile catCaptureFormatBMP, TempPfad+Datiname+".bmp"
Dim PowerPoint
On Error Resume Next
Set PowerPoint = GetObject (,"PowerPoint.Application")
If Err.Number <> 0 Then
Err.Clear
Set PowerPoint =CreateObject ("PowerPoint.Application")
End If
On Error GoTo 0
PowerPoint.Visible = TRUE
If PowerPoint.Presentations.Count = 0 Then
Dim PptPresentations
Dim PptCurrentSlide
Set PptPresentations = PowerPoint.Presentations.Add
Set PptCurrentSlide = PptPresentations.Slides.Add (1, 12)
End If
Dim PptSlideRange
Set PptSlideRange = PowerPoint.ActiveWindow.Selection.SlideRange
Dim PptShapes
Set PptShapes = PptSlideRange.Shapes
'das Bild in die Folie einfügen
Dim PptShape
Set PptShape = PptShapes.AddPicture ( TempPfad, True, True, 70, 70 )
Viewer3D1.PutBackgroundColor Array (color (0), color (1), color (2))
On Error Resume Next
Window1.Layout = WindowLayout1
CATIA.StartCommand "CompassDisplayOn"
On Error GoTo 0
Set PptObject = Nothing
Set Viewer1 = Nothing
fso.DeleteFile (TempPfad)
Set fso = nothing
End Sub
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP