+ Reply to Thread
Results 1 to 24 of 24

Macro that will adjust to a user screen resolution, once file is open.

  1. #1
    Registered User
    Join Date
    12-06-2015
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    79

    Question Macro that will adjust to a user screen resolution, once file is open.

    Looking for a code that will automatically adjust to a users screen resolution, once they open up the Excel file. What I have already is:

    Please Login or Register  to view this content.

  2. #2
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Macro that will adjust to a user screen resolution, once file is open.

    I tried it in a blank workbook and changed 100 to true and it worked as expected.
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  3. #3
    Registered User
    Join Date
    12-06-2015
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    79

    Re: Macro that will adjust to a user screen resolution, once file is open.

    [QUOTE=gmr4evr1;4276266]I tried it in a blank workbook and changed 100 to true and it worked as expected.[/QUOT

    Liked I stated above, I've tried the True function also, and it registered no difference. I sent 2 Test pages to a friend, Test and Test2. Test had the 100 and Test2 had the True. Both returned the same exact look on the screen.

  4. #4
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Macro that will adjust to a user screen resolution, once file is open.

    I think Excel 2013 do not behave in the same way as Excel 2010. Take a look at this youtube video

    https://www.youtube.com/watch?v=lA3e0u5JGEY

    Alf

  5. #5
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Macro that will adjust to a user screen resolution, once file is open.

    You can use the Windows API to do this.

    Please Login or Register  to view this content.
    Last edited by JapanDave; 01-01-2016 at 08:15 AM.
    Be fore warned, I regularly post drunk. So don't take offence (too much) to what I say.
    I am the real 'Napster'
    The Grid. A digital frontier. I tried to picture clusters of information as they moved through the computer. What did they look like? Ships? motorcycles? Were the circuits like freeways? I kept dreaming of a world I thought I'd never see. And then, one day...

    If you receive help please give thanks. Click the * in the bottom left hand corner.

    snb's VBA Help Files

  6. #6
    Registered User
    Join Date
    12-06-2015
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    79

    Re: Macro that will adjust to a user screen resolution, once file is open.

    Quote Originally Posted by JapanDave View Post
    You can use the Windows API to do this.

    Please Login or Register  to view this content.
    I've saw this code online, but I really don't understand how to use it. I've copied and pasted it into the VBA editor, but i never saw any difference. Maybe I'm using the code wrong. I need this code, incorporated, with this code, below:

    Please Login or Register  to view this content.
    How do I implement my code with your Windows API code?

  7. #7
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Macro that will adjust to a user screen resolution, once file is open.

    OK, try this,
    Edit, sorry I did not see your last posts code.
    Please Login or Register  to view this content.
    Last edited by JapanDave; 01-01-2016 at 08:36 PM.

  8. #8
    Registered User
    Join Date
    12-06-2015
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    79

    Re: Macro that will adjust to a user screen resolution, once file is open.

    Quote Originally Posted by JapanDave View Post
    OK, try this,
    Edit, sorry I did not see your last posts code.
    Please Login or Register  to view this content.
    I tried the code out, it didn't work, BUT could it be because i'm only trying it on my system? I've been trying it on my laptop, which is, 1366 x 768. I drop my screen resolution to 1024 x 768 to see the difference. Question is, is it because i'm trying it on my own system and not another?

  9. #9
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Macro that will adjust to a user screen resolution, once file is open.

    It should not matter what resolution the screen is. You do want it at 100% correct?

  10. #10
    Registered User
    Join Date
    12-06-2015
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    79

    Re: Macro that will adjust to a user screen resolution, once file is open.

    Quote Originally Posted by JapanDave View Post
    It should not matter what resolution the screen is. You do want it at 100% correct?
    Yes, correct, i do want it at 100%. I noticed when I put my screen resolution to 1024 x 768 that a lot of the right side is still cut off.

  11. #11
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Macro that will adjust to a user screen resolution, once file is open.

    Can you go into Visual Basic editor > View > open Intermediate window for me.

    Than put this code in a standard module and step through it with F8.
    Then can you tell me the value in the intermediate window of "mW" and "z"

    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    12-06-2015
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    79

    Re: Macro that will adjust to a user screen resolution, once file is open.

    Quote Originally Posted by JapanDave View Post
    Can you go into Visual Basic editor > View > open Intermediate window for me.

    Than put this code in a standard module and step through it with F8.
    Then can you tell me the value in the intermediate window of "mW" and "z"

    Please Login or Register  to view this content.
    Would it be better if i just sent a test file?

  13. #13
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Macro that will adjust to a user screen resolution, once file is open.

    I want to see what your PC spec is.

  14. #14
    Registered User
    Join Date
    12-06-2015
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    79

    Re: Macro that will adjust to a user screen resolution, once file is open.

    Quote Originally Posted by JapanDave View Post
    I want to see what your PC spec is.
    I only see Immediate window, not a Intermediate window

  15. #15
    Registered User
    Join Date
    12-06-2015
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    79

    Re: Macro that will adjust to a user screen resolution, once file is open.

    Quote Originally Posted by JapanDave View Post
    I want to see what your PC spec is.
    Ok, disregard the last message. When I followed what you said, the number that came up was 1311

  16. #16
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Macro that will adjust to a user screen resolution, once file is open.

    Than, it should be working fine. BTW, adjusting the screen resolution won't do anything for making Excel 100% zoom. Can you manually adjust the the zoom to 50% in "EXCEL" and then run this code.
    Then tell me if excel went back 100% zoom.

    Please Login or Register  to view this content.

  17. #17
    Registered User
    Join Date
    12-06-2015
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    79

    Re: Macro that will adjust to a user screen resolution, once file is open.

    Quote Originally Posted by JapanDave View Post
    Than, it should be working fine. BTW, adjusting the screen resolution won't do anything for making Excel 100% zoom. Can you manually adjust the the zoom to 50% in "EXCEL" and then run this code.
    Then tell me if excel went back 100% zoom.

    Please Login or Register  to view this content.
    I manually adjusted the excel file to 50%, first before entering the code. Than, I entered the code, then saved the file. When I re-opened the file, the file stayed at the 50% zoom.

  18. #18
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Macro that will adjust to a user screen resolution, once file is open.

    No, I need to to run the code I just posted while the file is open. Paste in a normal module in the VB editor, click run/play ,go back to the sheet you just adjust to 50% and tell me if the window is back to 100% zoom.

  19. #19
    Registered User
    Join Date
    12-06-2015
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    79

    Re: Macro that will adjust to a user screen resolution, once file is open.

    Quote Originally Posted by JapanDave View Post
    No, I need to to run the code I just posted while the file is open. Paste in a normal module in the VB editor, click run/play ,go back to the sheet you just adjust to 50% and tell me if the window is back to 100% zoom.
    The window did go back to 100% after i just tried what you stated.

  20. #20
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Macro that will adjust to a user screen resolution, once file is open.

    If that is the case, you workbook on open even is not working. Can you post the workbook without sensitive data?

  21. #21
    Registered User
    Join Date
    12-06-2015
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    79

    Re: Macro that will adjust to a user screen resolution, once file is open.

    Quote Originally Posted by JapanDave View Post
    If that is the case, you workbook on open even is not working. Can you post the workbook without sensitive data?
    I just tired the file I've been working on. I dropped the zoom percentage to 50%, then I saved the file. I re-opened the file up, and it opened up at 100% zoom. This is the code i was using:

    Please Login or Register  to view this content.

  22. #22
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Macro that will adjust to a user screen resolution, once file is open.

    So does that mean you are getting the results you need? If so mark the thread solved and don't forget to give reputation to those who helped you.

    Dave

  23. #23
    Registered User
    Join Date
    12-06-2015
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    79

    Re: Macro that will adjust to a user screen resolution, once file is open.

    Quote Originally Posted by JapanDave View Post
    So does that mean you are getting the results you need? If so mark the thread solved and don't forget to give reputation to those who helped you.

    Dave
    I have to make sure, this Monday, how it will open up on a friends computer, first. They have Excel 2010, because my main goal was to see if it can be adjusted on other computers besides just mine.

  24. #24
    Registered User
    Join Date
    12-06-2015
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    79

    Re: Macro that will adjust to a user screen resolution, once file is open.

    Quote Originally Posted by JapanDave View Post
    So does that mean you are getting the results you need? If so mark the thread solved and don't forget to give reputation to those who helped you.

    Dave
    So far, what I've noticed is that this code seems to work perfect on other laptops, but when it's being viewed on monitors, with different size screens, their's still parts of the worksheet information that's being cut off. I made this file on a 15.6" screen laptop.

+ 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. [SOLVED] Macro to Click 'X' Close Button Dependent on Screen Resolution
    By hobbiton73 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-27-2015, 04:43 AM
  2. [SOLVED] Macro that prompts user to select a file to open and perform another macro on this file
    By grimmy26 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-16-2014, 08:39 AM
  3. Adjust a Userforms Zoom based on screen resolution.
    By Baziwan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-15-2014, 10:00 AM
  4. [SOLVED] Adjust screen resolution automatically to fit all screen sizes
    By Ace_XL in forum Excel General
    Replies: 2
    Last Post: 06-14-2012, 08:51 AM
  5. Macro to adjust zoom percentage depending on users screen resolution?
    By Smeddlesboy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-05-2011, 06:45 AM
  6. [SOLVED] Change Screen Resolution Macro
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-17-2006, 01:30 AM
  7. Incorrect resolution of path to XLA file when user has roaming prf
    By Carl L in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-21-2005, 03:06 PM

Tags for this Thread

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