Closed Thread
Results 1 to 3 of 3

BIZARRE - ActiveWindow.NewWindow width doesn't follow VBA code

  1. #1
    Registered User
    Join Date
    05-25-2011
    Location
    Slovenia
    MS-Off Ver
    Office 365
    Posts
    7

    Unhappy BIZARRE - ActiveWindow.NewWindow width doesn't follow VBA code

    The idea is to open two windows of same Excel workbook at the same time, side-by-side, with specific window dimensions. For demonstration purposes I prepared an example of new workbook "Book1.xlsm" with two Worksheets ("Sheet1" and "Sheet2"). After pressing the "CommandButton1", there should be two windows of the Workbook placed on my monitor side-by-side ("Sheet1" on the left and "Sheet2" on the right) with next properties:

    • Left window showing "Sheet1" (Top=0, Left=0, Height=880, Width=960)
    • Right window showing "Sheet2" (Top=0, Left=960, Height=880, Width=960)

    I have two-monitor setup with screen resolution 1920×1200 each. You can see now that I'm trying to place each window on one half of one monitor (2 × 960 px = 1920 px).


    BUT(!) when the code is executed, the size and position of both windows are all WRONG:

    • Left window showing "Sheet1" (Top=-2, Left=-2, Height=1173, Width=1280)
    • Right window showing "Sheet2" (Top=-2, Left=1278, Height=1173, Width=1280)


    Does anyone know why is Excel ignoring size properties set in code and positions windows on these BIZARRE coordinates? Would you be so kind and test the code and posts the results here? Thank you in advance! Here is also the code behind "CommandButton1":


    Please Login or Register  to view this content.


    Disclamer: since I'm quite of noob in VBA, I'm gathering code parts from all over the internet. The code above is modified code, found on Stack overflow.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,448

    Re: BIZARRE - ActiveWindow.NewWindow width doesn't follow VBA code

    Hi and welcome
    please refrain from adding unnecessary text ( "Bizarre","Need help", etc..) to your thread title.
    Also be aware that common courtesy ("Hello", "thanks in advance", etc..) greatly improves your chances of getting answers.
    Thanks

  3. #3
    Registered User
    Join Date
    05-25-2011
    Location
    Slovenia
    MS-Off Ver
    Office 365
    Posts
    7

    Re: BIZARRE - ActiveWindow.NewWindow width doesn't follow VBA code

    Hi,

    Thank you Pepe Le Mokko for reminding me. It was my 'intentional' mistake to attract more views - which, I agree, wasn't quite appropriate.

    P.S.: I sent private message to Commercial Services Forum admin to delete the thread for me to post it there.


    BR
    morzapo

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA code to follow hyperlink doesn't work when cell contains formula
    By PFDave in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-26-2016, 04:19 AM
  2. Get source Code text from activewindow browser
    By wotadude in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-03-2010, 02:43 AM
  3. [SOLVED] Autofit doesn't work when column not enough width
    By Alex St-Pierre in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-19-2006, 02:40 PM
  4. Why is NewWindow Ignored?
    By Gary''s Student in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-20-2006, 10:35 AM
  5. ActiveWindow.VisibleRange.Width - Is this the correct code
    By StevenS in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-15-2005, 02:05 AM
  6. Formatting doesn't follow data sort
    By kanimalhouse in forum Excel General
    Replies: 1
    Last Post: 09-07-2005, 07:05 PM
  7. When using worksheet.hyperlink.follow .NewWindow:=true
    By View Source, Excel, Hyperlink, Follow in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-05-2005, 01:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1