VBA code to open in new Window

User avatar
adam
SilverLounger
Posts: 2347
Joined: 23 Feb 2010, 12:07

VBA code to open in new Window

Post by adam »

Hi anyone,

I'm using the following code to open the recoomended excel sheet from the same workbok in a new window. But when I open the sheet and open another workbook the opened workbook shows in minimized window on top of the opened workbook which I dont want to happen.

How could I modify the code so that it does not open the new work book in minimized window other than Cash V1.7.xlsm

I hope I've made my question clear.

Any help on this would be kindly appreciated.

Thanks in advance

Code: Select all

Sub OpenCustomerMasterList()
Application.ScreenUpdating = False
ActiveWindow.NewWindow
Windows.Arrange ArrangeStyle:=xlHorizontal
ActiveWindow.DisplayHorizontalScrollBar = False
ActiveWindow.DisplayWorkbookTabs = False
Application.DisplayFormulaBar = False
Application.DisplayStatusBar = False
Windows("Cash V1.7.xlsm:2").Activate
Sheets("CustomerMasterList").Select
ActiveWindow.DisplayGridlines = False
ActiveWindow.DisplayHeadings = False
Rows("11:11").Select
ActiveWindow.FreezePanes = True
Windows("Cash V1.7.xlsm:1").Activate
Sheets("NewMemo").Select
ActiveWindow.DisplayHeadings = False
Application.ScreenUpdating = True
End Sub
Best Regards,
Adam

User avatar
HansV
Administrator
Posts: 78542
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: VBA code to open in new Window

Post by HansV »

After arranging the windows (using the line Windows.Arrange ArrangeStyle:=xlHorizontal), the windows are not maximized within Excel any more. If you then open another workbook, it'll open in whatever windows size it was saved with. You could maximize it, but that would undo the horizontal arrangement of the windows of the Cash V1.7.xlsm workbook.
Best wishes,
Hans

User avatar
adam
SilverLounger
Posts: 2347
Joined: 23 Feb 2010, 12:07

Re: VBA code to open in new Window

Post by adam »

If I maximize the window where the CustomerSheet appears, the active sheet where I've applied the macro button would be unseen. I'm trying to keep the two sheets visible. And while the user wants another workbook to be open; the new workbook to be opened in normal mode.

Are you pointing out that this cannot be done?
Best Regards,
Adam

User avatar
HansV
Administrator
Posts: 78542
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: VBA code to open in new Window

Post by HansV »

If you have no other workbooks open, you now have three windows. You could arrange those three in various ways: horizontal, vertical, tiled.
Best wishes,
Hans

User avatar
adam
SilverLounger
Posts: 2347
Joined: 23 Feb 2010, 12:07

Re: VBA code to open in new Window

Post by adam »

Thanks for the help Hans.
Best Regards,
Adam