itisinteresting
itisinteresting

Reputation: 147

VSTO 2010 add-in doesn't open in a full-screen window

we have created a VSTO Excel workbook with VS2010, .NET 4.0. After we publish and install the xlsx document, it opens up as expected for the first time. Then we run some operation using the plug-in and save the workbook. After closing and reopening it again, the Excel frame opens full screen but the workbook opens in a small window that can not be re-sized.

     We have tried the following code on the following workbook events : Activate, Startup, Open 

Application.WindowState = XlWindowState.xlMaximized;
Application.ActiveWindow.WindowState = XlWindowState.xlMaximized;

Same result, the workbook opens in a small window that is not re-sizable. We would like for the workbook to open full screen.

Please submit recommendations/ideas.

Thank you.

Upvotes: 0

Views: 306

Answers (3)

itisinteresting
itisinteresting

Reputation: 147

The problem was in the workbook having structure protection in place and I had to disable that before saving the workbook, putting the protection back after the save operation is complete. Thank you.

Upvotes: 1

VARINDER CHHABRA
VARINDER CHHABRA

Reputation: 11

This will work:

private void ThisWorkbook_Startup(object sender, System.EventArgs e) {
    Globals.ThisWorkbook.Application.WindowState = XL.XlWindowState.xlMaximized

Upvotes: 1

Brijesh Mishra
Brijesh Mishra

Reputation: 2748

try

Application.ActiveWindow.ActivateNext();
Application.ActiveWindow.WindowState = XlWindowState.xlMaximized

Upvotes: 0

Related Questions