+ Reply to Thread
Results 1 to 13 of 13

Set a workbook width with VBA

  1. #1
    Forum Contributor
    Join Date
    06-25-2013
    Location
    Longview, TX
    MS-Off Ver
    MS365
    Posts
    338

    Set a workbook width with VBA

    Hi again,

    The title explains it pretty well, LOL! Is it possible to use VBA to set the width of the whole workbook?

    Jenny

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Set a workbook width with VBA

    Do you mean the whole Excel application window?
    Please Login or Register  to view this content.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Forum Contributor
    Join Date
    06-25-2013
    Location
    Longview, TX
    MS-Off Ver
    MS365
    Posts
    338

    Re: Set a workbook width with VBA

    Not the whole Excel Window, just the particular workbook that I'm working with. I already have a macro to format (etc) the worksheet, but I hoped to change the width of the workbook itself so that they're the same width each month.
    Nobody else at my work would care, but I do. (There's a CHANCE I might be a little OCD, LOL!)

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Set a workbook width with VBA

    Not sure what you mean, then. Do you mean column widths?

  5. #5
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Set a workbook width with VBA

    Try posting a screenshot of what you start with, and what your required outcome looks like.

  6. #6
    Forum Contributor
    Join Date
    06-25-2013
    Location
    Longview, TX
    MS-Off Ver
    MS365
    Posts
    338

    Re: Set a workbook width with VBA

    Sorry, often I'm not real clear at explaining things.

    The "main" excel window is the size of my screen, and I've got the column widths the way I want them. What I want to change is the width of the workbook that the worksheet is located in. So, if the path to the file is, for example, "C:\Imports\Financial\Analysis\09-14", I want to change the width of "09-14", not an individual worksheet within "09-14".

    Jenny

  7. #7
    Forum Contributor
    Join Date
    06-25-2013
    Location
    Longview, TX
    MS-Off Ver
    MS365
    Posts
    338

    Re: Set a workbook width with VBA

    Hmmm, I can't seem to figure out how to post a screenshot. I've done it before, but it won't let me today.

  8. #8
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Set a workbook width with VBA

    Okay. I'm guessing you are opening multiple workbooks within one Excel application instance.

    This is a display option in Excel 2010. This ability was removed in Excel 2013 - each workbook opens in its own application instance.

    I'm guessing you want to resize the workbook window within the (maximized) Excel application? Is this right?

    I'm afraid I can't help any further - only have 2013 on this PC, to play with. Will ask for more help from others.

  9. #9
    Forum Contributor
    Join Date
    06-25-2013
    Location
    Longview, TX
    MS-Off Ver
    MS365
    Posts
    338

    Re: Set a workbook width with VBA

    Okay, thanks for trying. I only want to change the width for this one report, so I'm hoping to be able to add it to my macro.

    Have a great day!

    Jenny

  10. #10
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Set a workbook width with VBA

    this seems to work for me....it's a take on Olly's code...
    set the 750 to what ever you want...
    put this right after you open the window or run the macro while the workbook is active....

    Please Login or Register  to view this content.
    Ernest

    Please consider adding a * if I helped

    Nothing drives me crazy - I'm always close enough to walk....

  11. #11
    Forum Contributor
    Join Date
    06-25-2013
    Location
    Longview, TX
    MS-Off Ver
    MS365
    Posts
    338

    Re: Set a workbook width with VBA

    AWESOME! That works perfectly!!

    Thanks judgeh and Olly; You guys rock!

    Jenny

  12. #12
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Set a workbook width with VBA

    no problem....Olly is really good at VBA....have a great day....

  13. #13
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Set a workbook width with VBA

    Thanks Olly

+ 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: 07-30-2014, 11:13 AM
  2. I Want to Set my excel workbook window Width =, Height =
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-11-2014, 12:35 AM
  3. export filtered data (including header row) to new workbook, maintain column width
    By ovetcobo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-26-2013, 03:47 PM
  4. [SOLVED] Set Column Width Based On Total Width Of Other Columns
    By rayneraingoaway in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-28-2006, 06:10 PM
  5. [SOLVED] Determining the height and width of Print_Area in a closed workbook
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-18-2005, 09:11 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