none
Application do not make Excel workbook visible RRS feed

  • Question

  • Hello,

    I have the following issue: I open Excel workbook with Excel Interop in C# .Net desktop application. It works fine on my PC.

    But when my colleague tried to run this app on his PC, workbook did not become visible (he opened workbook via this app, we saw Excel process in task manager appeared, but excel did not appeared).

    I have no idea, why this could happen.. I set visibility of excel app to true and it works fine on my PC, as I mentioned. The relevant part of code is below:

            private Excel.Application ex_App;
            private Excel.Workbook Model_File;
            private Excel.Workbooks Books;
            private const string password = "...";
    
    if (OpenModelDialog.ShowDialog() == DialogResult.OK)
                    {
                        ex_App.Visible = true;
                        File_Path = OpenModelDialog.FileName;
    
                        //Open excel file not read-only with password 
                        OpenModel(File_Path, false, true);
                    }
    
    private void OpenModel(string FP, bool RO, bool ApV)
            {
                if (ApV)
                {
                    ex_App.Visible = true;
                }
                else
                {
                    ex_App.Visible = false;
                }
    
                try
                {
                    OpenModelFlag = true;
                    ProcessCount = 0;
                    Model_File = Books.Open(FP, RO, Password: password);
                    this.Visible = false;
                    
                }
                catch { MessageBox.Show("Can not open selected workbook."); }
            }
    
    

    Monday, June 19, 2017 8:40 AM

Answers

  • Hi PG_Develop,

    Which version of Office are you using and which version of Office is  your colleague using? I have developed an application using Office 2016 and it works well for other version of office. Will other pc always be unable to see the excel file? How do you instantiate the ex_App and Books object? I will show you my project for testing and I also suggest you share us your project so we could to try to reproduce your issue. Here is my project link https://1drv.ms/u/s!ArC0gnwxLv5qhiB8MnuakiXPdyNP.

    Best Regards,

    Terry

    • Marked as answer by PG_Develop Tuesday, July 4, 2017 1:27 PM
    Tuesday, June 20, 2017 7:30 AM

All replies

  • Hi PG_Develop,

    Which version of Office are you using and which version of Office is  your colleague using? I have developed an application using Office 2016 and it works well for other version of office. Will other pc always be unable to see the excel file? How do you instantiate the ex_App and Books object? I will show you my project for testing and I also suggest you share us your project so we could to try to reproduce your issue. Here is my project link https://1drv.ms/u/s!ArC0gnwxLv5qhiB8MnuakiXPdyNP.

    Best Regards,

    Terry

    • Marked as answer by PG_Develop Tuesday, July 4, 2017 1:27 PM
    Tuesday, June 20, 2017 7:30 AM
  • Hi, Terry,

    I apologize for late response. We both use Office 2013. The issue was solved by setting Visible to true manually after opening the workbook (hence the check of ApV parameter doesn't work anymore)

    Sorry, but I can not share my project due to confidentiality issues. 

    But thank you very much for response!

    Best regards,

    PG


    • Edited by PG_Develop Tuesday, July 4, 2017 3:39 PM
    Tuesday, July 4, 2017 3:39 PM