Power Point OLEObject

时间:2017-02-28 09:38:29

标签: excel-vba powerpoint-vba createoleobject vba excel

我正在从电源点的其他应用程序(NX Cad)创建一个OLEobject。创建powerpoint后,我无法编辑我创建的工作表的值。它正在消失,只显示没有值的Sheet1。如何更新或修复此问题。

         Try
            Dim objPPTShape As Object = Nothing
            objPPTShape = ActiveSlide.Shapes.AddOLEObject(Left:=490,Top:=60, Width:=220, Height:=420, ClassName:="Excel.Sheet", DisplayAsIcon:=False, Link:=False)

            Dim Mysheet As Object = Nothing
            Mysheet = objPPTShape.OLEFormat.Object.Worksheets.add()
            Mysheet.Name() = "NX Update"

            With Mysheet

                .Cells(1, 1).value = "XXX"

               .Cells(13, 2).value = "XXXX"

                'Format the Excel table
                With .Range(.Cells(1, 1), .Cells(13, 2))
                    .Borders.Weight = 1
                    .Font.Name = "Times New Roamn"
                    .Font.Bold = False
                    .Font.Size = 12
                    .RowHeight = 20
                    .ColumnWidth = 30
                End With

                'Title Block
                With .Range(.Cells(1, 1), .Cells(1, 2))
                    .Font.Bold = True
                    .Font.Size = 14
                End With

            End With

        Catch ex As Exception
            lw.WriteLine(ex.Message.ToString)
        End Try

0 个答案:

没有答案