none
how to avoid empty excel is coming out RRS feed

  • Question

  • hi,

    In our power point application we are embedding excel object and inserting activeX control inside the excel object.i am getting unwanted excel comes out in below scenarios.

    1)when assigning the power point excel object with excel workbook.

    2)when activating the activeX object.

    the below code is for creating excel object

    ppShape = presentation.Slides(intSlideIndex).Shapes.AddOLEObject(Classname:=cExcelOffice12Sheet)

    the code is for assigning the power point excel object with excel workbook.

            Dim ppSlide As Microsoft.Office.Interop.PowerPoint.Slide
            Dim ppShape As Microsoft.Office.Interop.PowerPoint.Shape
            Dim Wkb As Microsoft.Office.Interop.Excel.Workbook

          For Each ppSlide In ppSlides

       For Each ppShape In ppSlide.Shapes

    Wkb = ppShape.OLEFormat.Object  'Here excel comes out

                Next ppShape

            Next ppSlide

    is there any way to stop empty excel comes out ? or how to hide the opened empty excel alone, not other opened excel instance ?


    prince rajan

    Tuesday, March 25, 2014 5:28 PM

Answers

  • Hi Rajan,

    I was trying to reproduce the issue but it failed. Here is the steps:
    1. Create a PowerPoint add-in
    2. Add two buttons on the ribbon
    3. The first button event is like below to insert the embed Excel into first silde

    Private Sub Button1_Click(sender As Object, e As RibbonControlEventArgs) Handles Button1.Click
            Globals.ThisAddIn.Application.ActivePresentation.Slides(1).Shapes.AddOLEObject(ClassName:="Excel.Sheet.12")
        End Sub

    4. The second button event is get the OLE object like below:

    Private Sub Button2_Click(sender As Object, e As RibbonControlEventArgs) Handles Button2.Click
            Dim Wkb As Object
            For Each ppSlide In Globals.ThisAddIn.Application.ActivePresentation.Slides
    
                For Each ppShape In ppSlide.Shapes
    
                    Wkb = ppShape.OLEFormat.Object  'Here excel comes out
    
    
                Next ppShape
    
            Next ppSlide
    End Sub
    

    5. Close Excel application on the machine
    6. Run the project then delete the shapes on the first slide
    7. Click the first and second button, no Excel application shows
    I suggest you trying hide the Excel application using code below:

    Wkb.Application.Visible=false

    Or would you mind sharing the detail steps with us to reproduce this issue?

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, March 26, 2014 10:11 AM
    Moderator
  • Hi Rajan,

    I still can't reproduce this issue using VBA. Below is my test steps:

    1. Create a new presentation and delete all shapes on the first slide

    2. Add a module and past the code to the module

    Sub test()
    
    
    Set workbbok = Application.ActivePresentation.Slides(1).Shapes.AddOLEObject(ClassName:="Excel.Sheet.12")
    
        For Each ppSlide In Application.ActivePresentation.Slides
    
                For Each ppShape In ppSlide.Shapes
    
    
                Set Wkb = ppShape.OLEFormat.Object
    
    
                Next ppShape
    
            Next ppSlide
    
    End Sub

    3. Run the test sub

    I test the code in PowerPoint 2007, 2010, 2013. All products run the code well.

    I suggest you repairing the Office to see whether this issue is fixed.

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Friday, March 28, 2014 9:42 AM
    Moderator

All replies

  • Hi Rajan,

    I was trying to reproduce the issue but it failed. Here is the steps:
    1. Create a PowerPoint add-in
    2. Add two buttons on the ribbon
    3. The first button event is like below to insert the embed Excel into first silde

    Private Sub Button1_Click(sender As Object, e As RibbonControlEventArgs) Handles Button1.Click
            Globals.ThisAddIn.Application.ActivePresentation.Slides(1).Shapes.AddOLEObject(ClassName:="Excel.Sheet.12")
        End Sub

    4. The second button event is get the OLE object like below:

    Private Sub Button2_Click(sender As Object, e As RibbonControlEventArgs) Handles Button2.Click
            Dim Wkb As Object
            For Each ppSlide In Globals.ThisAddIn.Application.ActivePresentation.Slides
    
                For Each ppShape In ppSlide.Shapes
    
                    Wkb = ppShape.OLEFormat.Object  'Here excel comes out
    
    
                Next ppShape
    
            Next ppSlide
    End Sub
    

    5. Close Excel application on the machine
    6. Run the project then delete the shapes on the first slide
    7. Click the first and second button, no Excel application shows
    I suggest you trying hide the Excel application using code below:

    Wkb.Application.Visible=false

    Or would you mind sharing the detail steps with us to reproduce this issue?

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, March 26, 2014 10:11 AM
    Moderator
  • Hi Fei,

    Thanks for your reply,

    i hope u have tried to replicate the issue in VBA. the issue is occuring when coding in VB.Net

    i have tried wkb.application.visible = false , but all the excel instances are got hidden, my requirement is only opened empty excel also gets hide, not all the excel instances which is running.



    prince rajan

    Wednesday, March 26, 2014 5:11 PM
  • Hi Rajan,

    I still can't reproduce this issue using VBA. Below is my test steps:

    1. Create a new presentation and delete all shapes on the first slide

    2. Add a module and past the code to the module

    Sub test()
    
    
    Set workbbok = Application.ActivePresentation.Slides(1).Shapes.AddOLEObject(ClassName:="Excel.Sheet.12")
    
        For Each ppSlide In Application.ActivePresentation.Slides
    
                For Each ppShape In ppSlide.Shapes
    
    
                Set Wkb = ppShape.OLEFormat.Object
    
    
                Next ppShape
    
            Next ppSlide
    
    End Sub

    3. Run the test sub

    I test the code in PowerPoint 2007, 2010, 2013. All products run the code well.

    I suggest you repairing the Office to see whether this issue is fixed.

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Friday, March 28, 2014 9:42 AM
    Moderator