none
Hide Excel from popping out when creating slide in PowerPoint RRS feed

  • Question

  • Hi, l have an application that will generate PowerPoint and create some chart within the PowerPoint.

    i've been using Interop.Powerpoint.Slide.Shapes.AddChart() to create chart in PowerPoint. The momment this function is called, an Excel window will pop out for us to fill in the data. Is there any way to tell Excel window open in minimize mode/behind other application instead of popping out and became the active window? Even if I do Chart.ChartData.Workbook.Application.Visible = falseExcel window still shows up a little while. Some of the device the Excel window will automatically open behind other application but some don't.

    Friday, January 30, 2015 1:04 AM

All replies

  • Hi,

    I've moved this thread to General Office Development forum since it's related to Office development, you will get more dedicated support from the experts here.

    Regards,

    Melon Chen
    TechNet Community Support


    It's recommended to download and install Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office programs.

    Friday, January 30, 2015 6:21 AM
  • Hello Lee,

    Try to automate Excel on your own creating a chart and then just adding a ready-made file to the slide. Does it make sense?

    The How to automate Microsoft Excel from Visual Basic article describes the required steps for automating Excel.

    Friday, January 30, 2015 7:28 AM
  • Hi Eugene,

    Thanks for the reply, but for my case I think I can't generate the chart in Excel and import it into PowerPoint since we will use different template of PowerPoint based on user's information.

    By using different template, the colors of label within the charts will different based on the template. I believe that if we generate the chart in Excel, we might lose some features which if we generate in PowerPoint right?


    Friday, January 30, 2015 7:57 AM
  • Even if I do Chart.ChartData.Workbook.Application.Visible = falseExcel window still shows up a little while. Some of the device the Excel window will automatically open behind other application but some don't.

    Hi Lee,

    As far as I know, when you create a new Chart and access the Chart.ChartData.Workbook object, an Excel application will be automatically created and the default Visible is True. If you want some other windows on the foreground, as a workaround, you could P/Invoke setforegroundwindow function after you process the chart data.


    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, February 4, 2015 8:17 AM
    Moderator
  • Hi Caillen,

    If we P/Invoke setforegroundwindow function after i process the chart data thats mean the excel still will in foreground before i process the chart data? Or we can setforegroundwindow before accessing Chart.ChartData.Workbook object?

    Wednesday, February 4, 2015 9:23 AM
  • It doesn't matter whether the Excel window is on the foreground or background at the very beginning. You can try it.

    A code sample here could be helpful to you:

    http://www.pinvoke.net/default.aspx/user32.setforegroundwindow


    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, February 6, 2015 2:09 AM
    Moderator
  • Interop library come along with Chart.ChartData.Workbook.Application.Visible features. I wondering if both of them is the same? Because by using  Chart.ChartData.Workbook.Application.Visible, we can minimize the Excel window but when we creating another chart, a new Excel window will still open in foreground.
    Friday, February 6, 2015 2:24 AM
  • I'm a little bit confused by your question. When you set chart.ChartData.Workbook.Application.Visible to False, it'll hide the Excel application window, but not minimize it as you said. If there're multiple charts in the slide, when you edit the charts' data, they should share the same Excel application process. Anyway if the other Excel window shows up again, you can still hide it.

    Excel.Workbook workbook1 = chart1.ChartData.Workbook as Excel.Workbook;
    workbook1.Application.Visible = false;
    
    ...
    
    Excel.Workbook workbook2 = chart2.ChartData.Workbook as Excel.Workbook;
    workbook2.Application.Visible = false;

    If you want some other window to be in the foreground, use setforegroundwindow function.


    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.


    Sunday, February 8, 2015 8:14 AM
    Moderator
  • Sorry about my bad english =( What i mean is is that anyway to tell Excel open in background by default whenever we adding charts.
    Sunday, February 8, 2015 12:19 PM
  • Sorry about my bad english =( What i mean is is that anyway to tell Excel open in background by default whenever we adding charts.

    As far as I know, no. It is visible by default.

    As we talked earlier, you can set the Visible to false, and use setforegroundwindow function to put a specified window in the foreground. That is the workaround for your problem.


    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.

    Monday, February 9, 2015 3:18 AM
    Moderator
  • If we set the visible to false, the Excel window still will shows up a little while. This will make automating chart creation error-prone if user have accidentally input something into the Excel worksheet. COMException will be throws if we modify or input something into the Excel worksheet when the chart creation is on going.
    Monday, February 9, 2015 4:06 AM
  • I recommend that when your application is automating the PowerPoint presentation and creating Chart in a slide, prevent the user from input anything in the slide. Give the user an alert, tell the user it's busy creating chart for them.

    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, February 11, 2015 7:46 AM
    Moderator
  • Currently the user will not able to use the computer when it is creating chart. But some time it used up to 1 hours to creating a complete PowerPoint file with 100+ slides. So we try to find if there is anyway to hide the Excel window from popping out.

    Because in some device, the Excel window will open in background instead of popping out. But some just can't. I did compare the version of PowerPoint and Excel of the devices but it is same. So i wondering if we can modify the setting/behavior of PowerPoint or Excel through regedit?


    • Edited by Lee Kenvin Monday, February 16, 2015 9:38 AM
    Thursday, February 12, 2015 2:32 AM
  • Hi Lee Kenvin

    What you're experiencing is a behavior that cannot be configured or changed. I asked this during beta testing because it is a real bother, but it cannot be changed.

    <<Currently the user will not use the computer when it is creating chart. But some time it used up to 1 hours to creating a complete PowerPoint file with 100+ slides. >>

    What I was told during that beta was to leverage the new Open XML file format and generate the file without resorting to automating the application interfaces. You'll find more information on OpenXMLDeveloper.org. Besides not bothering the user with application windows, code execution should be MUCH faster than you're currently seeing.


    Cindy Meister, VSTO/Word MVP, my blog

    Sunday, February 15, 2015 8:38 PM
    Moderator
  • Hi Cindy,

    I understand that the behavior cannot be changed or configured, but just wonder why in some machine, the Excel window will open in behind others window automatically. I've compare the version for both PowerPoint and Excel but it is same.

    Thanks for the solution by using OpenXML, i will look into it when we decided to use it.

    Monday, February 16, 2015 3:08 AM
  • Hi Lee

    It's possible that some other sofware is installed on the machines that's affecting how / where the Excel window opens. It should be opening in front, so whatever is causing the behavior you'd like to have is "wrong".

    You'd need to use Caillen's suggetsed approach to approximate what you'd like to have. If, as you say, the process would be running without a user - "Currently the user will not use the computer when it is creating chart..." - then it shouldn't matter whether it appears for a second or so in front? Possibly, you could even extend Caillen's suggestion for using the Windows API to keep the screen from repainting until you've sent the window to the back? (I'm not an expert on the Windows API but I'm guessing that should be possible.)


    Cindy Meister, VSTO/Word MVP, my blog

    Monday, February 16, 2015 9:15 AM
    Moderator
  • Hi Cindy,

    Sorry for the any confusion, what i mean is the user will not able to use the computer when it is creating charts.

    I guess the Window API is similar to set Excel window visible to false, since we will close the current Excel window and a new Excel window will be opened up once we insert a new chart again. 

    Monday, February 16, 2015 9:38 AM