+ Reply to Thread
Results 1 to 15 of 15

Workbook Resizing - How To Prevent ?

  1. #1
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Workbook Resizing - How To Prevent ?

    Can anyone point me to an example of how to prevent the workbook from being resized when opened ?

    My project has a set dimension for functionality.

    Thank you !

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Workbook Resizing - How To Prevent ?

    Hi there,

    Try inserting the following code into the ThisWorkbook VBA CodeModule of your workbook and see if it does what you need:

    Please Login or Register  to view this content.
    The highlighted values can be altered to suit your own requirements.


    Hope this helps - please let me know how you get on.

    Regards,

    Greg M

  3. #3
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Workbook Resizing - How To Prevent ?

    Greg

    The code sets the workbook to the correct size but doesn't stop anyone from resizing the window or the workbook manually.

    I've done alot of searching today for something that will "freeze" the workbook/window ... no luck.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: Workbook Resizing - How To Prevent ?

    You could try protecting the structure of the workbook with a password.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Workbook Resizing - How To Prevent ?

    Hi again,

    Many thanks for your feedback.

    Does the following code help? It doesn't prevent a User from resizing the window manually, but it undoes his/her resizing immediately afterwards.

    As before, the code should be inserted in the ThisWorkbook VBA CodeModule.

    Please Login or Register  to view this content.
    Alter these values to suit your requirements.



    Hope this helps - as always, please let me know how you get on.

    Regards,

    Greg M

  6. #6
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Workbook Resizing - How To Prevent ?

    Hey Greg:

    It works great on the worksheet but the Main Workbook is still resizable.

    Is there a means of applying that code to the WorkBook instead of the WorkSheet ?

    Thank you.

  7. #7
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Workbook Resizing - How To Prevent ?

    Have you looked at the Workbook_WindowResize event in the ThisWorkbook code module?
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  8. #8
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Workbook Resizing - How To Prevent ?

    Im still learning.

    What should I do with

    Please Login or Register  to view this content.
    I believe you may be referring to a change in the syntax but I'm not certain how to proceed.

  9. #9
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Workbook Resizing - How To Prevent ?

    Hi again,

    I'm not really sure what you mean by:

    It works great on the worksheet but the Main Workbook is still resizable.

    When I open the workbook I can drag the corners/edges of the Excel window to resize it, but as soon as I release the mouse button the VBA code immediately resets the window to the dimensions specified in the code.


    Regards,

    Greg M

  10. #10
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Workbook Resizing - How To Prevent ?

    It doesn't work that way for me. I'm probably using the wrong terms but I'll try to explain what occurs on my system.

    Excel has the main window or workbook. Then within that main frame is another window or the "sheet" that you work with. The sheet resizes back to its original dimensions, but the main window/workbook can still be expanded in any direction. It does not shrink back.

    Is there a way to ammend the code so the main window automatically resizes as well ?

    Or - should the code as presented, already do that ? If so, I wonder what is going on with my system.

  11. #11
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Workbook Resizing - How To Prevent ?

    Hi again,

    Sorry about the delay in getting back to you.

    I'm running Windows 7 and Office 2013.

    I don't have a "frame within a frame" representing the worksheet, just an overall window (on the Desktop) for the Excel application. As mentioned previously, if the User tries to resize the overall window, the VBA code will reset the dimensions of that window to those specified in the code.

    Regards,

    Greg M

  12. #12
    Forum Contributor
    Join Date
    08-09-2012
    Location
    British Columbia
    MS-Off Ver
    Excel 2010
    Posts
    189

    Re: Workbook Resizing - How To Prevent ?

    Two different things in play here.
    ... the application ie: Excel, which has the bigger X in upper right corner of the Excel application window
    ... the application document ie: the workbook, which has a smaller X, below the other, inside the application window


    Perhaps Andrew Poulsom's posts #6 & #10 in this discussion will be of use.

    The thread here looks to have similar issues to what you currently have. I found the last post very telling as to who would know how to handle things.

    And that leads to this and this, unfortunately the file link is ancient.


    Hope this posts, been getting Server too busy, try again later all day.

  13. #13
    Forum Contributor
    Join Date
    08-09-2012
    Location
    British Columbia
    MS-Off Ver
    Excel 2010
    Posts
    189

    Re: Workbook Resizing - How To Prevent ?

    posted twice

  14. #14
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Workbook Resizing - How To Prevent ?

    NoSparks:

    Thank you for digging up this information. I marvel how you are able to locate these things.

    See ya friend !



    GregM:

    Thank you for your assistance. I'm using Excel 2007 and Win 10.
    Have a great day !
    Last edited by Logit; 10-07-2016 at 07:10 AM. Reason: addition

  15. #15
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Workbook Resizing - How To Prevent ?

    Hi again,

    Many thanks for all of your feedback and also for the Reputation increase - much appreciated

    Confusion cleared - Excel 2013 doesn't have a Minimize Workbook "X" button, just a Minimize Application "X" button.

    Best regards,

    Greg M

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 08-21-2013, 10:00 AM
  2. Resizing separate worksheets in workbook to fit different screen resolutions
    By peterleightonjones in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 12-19-2011, 01:57 PM
  3. Resizing cells in a selection without resizing entire sheet
    By Danielle via OfficeKB.com in forum Excel General
    Replies: 4
    Last Post: 08-11-2006, 05:10 PM
  4. Prevent someone from renaming a workbook
    By Sethaholic in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-03-2006, 04:45 AM
  5. Prevent Pivot Table Resizing
    By M. Wirtzfeld in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-12-2005, 05:30 PM
  6. [SOLVED] how do I prevent a workbook from being saved?
    By crimsonkng in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-02-2005, 06:17 PM
  7. Replies: 5
    Last Post: 09-05-2005, 12:05 PM
  8. [SOLVED] Resizing "comments" boxes in a workbook all at once
    By rita in forum Excel General
    Replies: 2
    Last Post: 02-18-2005, 10:06 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