Results 1 to 2 of 2

Setting pixel size and position of window

Threaded View

  1. #1
    Forum Contributor terrypin's Avatar
    Join Date
    01-06-2010
    Location
    East Grinstead, UK
    MS-Off Ver
    MS Office 365
    Posts
    548

    Setting pixel size and position of window

    I'm trying to use this code near the start of a macro to set the size and position of the Excel window in pixels.

    Sub TestSizePosition()
    'Size/Position Tracksheet
    Application.WindowState = xlNormal
    Application.Left = 200
    Application.Top = 1
    Application.Width = 800
    Application.Height = 800
    'But the results are very different to the values set
    
    End Sub
    As you see below, the actual results from a few tests bear little relation to the settings.
    ---------- SET ---------  -------- ACTUAL ---------
    Left,Top  Width x Height  Left,Top  Width x Height
    ========  =============   ========  ==============
    0,0        1000 x 1000     -2,-2     1333 x 1208
    2,2        1500 x 1080     1,1       1928 x 1208
    1,1        1800 x 1000     0,0       1928 x 1208
    1,1        1600 x 1000     0,0       1928 x 1208
    1,1        1200 x 1000     0,0       1600 x 1208
    1,1         900 x  960      0,0      1200 x 1208
    1,1         800 x  500      0,0      1066 x  666
    200,1       800 x  800    265,0      1066 x  666
    What is going wrong and how can I get an accurate result please?

    I've attached an example of the workbooks I want to size.

    EDIT: A short time after posting I found a page which implies the actual values are roughly 3/4 of the Settings. So are there no commands for generating exact pixel sizes and positions?
    Attached Files Attached Files
    Last edited by terrypin; 01-09-2020 at 04:22 PM.
    Terry, East Grinstead, UK
    Excel 365, Win 10 Pro, i7 PC, 4.0 GHz

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Setting the size and position of a slicer based on Formula Name
    By JimmyA in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-02-2018, 07:08 AM
  2. [SOLVED] Problem maintaining window size/position when resaving shared file
    By Suzanne Irene in forum Excel General
    Replies: 5
    Last Post: 07-14-2015, 04:43 PM
  3. [SOLVED] Find Pixel Position of a Cell
    By TheSpriceEffect in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-07-2014, 09:06 AM
  4. pdf window size and position
    By var in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-26-2014, 09:25 AM
  5. Excel - Window to stay same size and position
    By flipflop in forum Excel General
    Replies: 0
    Last Post: 12-30-2010, 05:22 AM
  6. [SOLVED] Window Position & Size
    By socialism001@yahoo.com in forum Excel General
    Replies: 4
    Last Post: 05-18-2005, 01:06 PM

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