none
how to avoid empty excel is coming out in Office 2013 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



    • Edited by prince rajan Tuesday, March 25, 2014 5:26 PM
    • Moved by Barry Wang Wednesday, March 26, 2014 10:00 AM Office dev General
    Tuesday, March 25, 2014 5:13 PM

All replies

  • This is happening in Office 2013

    prince rajan

    Tuesday, March 25, 2014 5:19 PM
  • Hello prince rajan,

    I'm moving this case to Office Dev forum since it is related to this forum.

    Regards,



    Barry Wang
    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:00 AM
  • Hi,

    Based on my understanding, you want to know how to check if excel sheet is empty.

    You can use the Worksheet.UsedRange return the used range on the specified worksheet, and then you can check the length of this range is empty.

    Here is a method for your reference:

    Function SheetIsEmpty(ws As Worksheet) As Boolean
    Dim rng As Range
    Set rng = ws.UsedRange
    If rng.Count = 1 Then
    
           SheetIsEmpty = (Len(rng) = 0)
    End If
    End Function

    Regards,

    Marvin


    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:17 AM
  • No, Actually i need avoid excel comes out or i need vb.net code to hide opened empty excel alone not other excel instance which is running 

    prince rajan

    Wednesday, March 26, 2014 5:05 PM
  • Hi,

    I reproduce your issue in my side, when I assign embed workbook as excel workbook object, the excel application will be created, you can use application .visible = false to set this excel application as background process.

    Please refer to my code sample below:

    PowerPoint.Application ppApp = new PowerPoint.Application();
                PowerPoint.Presentations ppPresens = ppApp.Presentations;
                PowerPoint.Presentation objPres = ppPresens.Open(@"D:\1.pptx", MsoTriState.msoFalse, MsoTriState.msoTrue, MsoTriState.msoTrue);
                Excel.Workbook wb = objPres.Slides[1].Shapes[1].OLEFormat.Object;
                wb.Application.Visible = false;
                wb.ActiveSheet.Shapes[1].Select();
    

    Regards,

    Marvin


    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, April 2, 2014 11:13 AM