开发者

Enable Excel "View Side by Side" and "Synchronous Scrolling"

I created a C# program that opens 2 Excel worksheets Ex:

Process.Start(@"c:\test\test1.xlsx");
Process.Start(@"c:\test\test2.xlsx");

All I want to do after opening excel with these 2 sheets is enable the "View Side by Side" and "Synchronous Scrolling". These two options are under the View tab. I currently enable them manually, but would love to have that option enabled automatically. Does anyone have any idea how 开发者_JAVA百科to achieve this? Thank you in advance.


You can use automation from C# to control the Excel application.

Create a reference to the Excel application and then open both workbooks. From there it should be a simple matter of writing code like this to enable the "Side by Side" view:

Windows.CompareSideBySideWith "test1"
Windows.SyncScrollingSideBySide = True


You should look into creating a Visual Basic for Applications (VBA) procedure that is run from within Excel.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜