Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8280607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:44:22+00:00 2026-06-08T09:44:22+00:00

I have an Excel 2003 macro to adjust my screen zoom based on the

  • 0

I have an Excel 2003 macro to adjust my screen zoom based on the screen resolution.

Sub Macro1()
   Dim maxWidth As Long, myWidth As Long
   Dim myZoom As Single

   maxWidth = Application.UsableWidth * 0.96
   'I use r because upto r i have macro buttons
   myWidth = ThisWorkbook.ActiveSheet.Range("r1").Left
   myZoom = maxWidth / myWidth
   ActiveWindow.Zoom = myZoom * 100
End Sub

When I try in Excel 2003, button size & its caption are not zooming properly.
And Application.UsableWidth is always returning 1026 as width for either the screen resolution 1024*768 or 1366*768. Any ideas?

I want the Excel sheet to be fit in width if open in any system screen resolution

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T09:44:24+00:00Added an answer on June 8, 2026 at 9:44 am

    You can add this Windows API call to your code which can determine the screen resolution.

    Private Declare PtrSafe Function GetSystemMetrics Lib "USER32" _
     (ByVal nIndex As Long) As Long
    
      Sub Macro1()
        Dim maxWidth As Long
        Dim myWidth As Long
        Dim myZoom As Single
    
        maxWidth = GetSystemMetrics(0) * 0.96
        myWidth = ThisWorkbook.ActiveSheet.Range("R1").Left
        myZoom = maxWidth / myWidth
        ActiveWindow.Zoom = myZoom * 100
    
      End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Excel 2003, I have a macro that accidentally tried selecting a page field
I have built template-based add ins for Word and Excel version 2003 and previous.
I have an Excel 2003 workbook that contains a macro to copy certain of
I have an MS Office 2003 excel file with macro. I have to parse
I have created the macro below in Microsoft Excel 2003 on a windows XP
I have an excel 2003 vsto workbook that I would like to make available
I Have an Excel 2003 file with a line similar to this: I need
As the title explains, I have an Excel 2003 workbook and I'm copying a
Excel 2003 Question: I'd like to have one cell represent a range of cells.
I have a set od Excel (2003) sheets saved as .xlt format. Now ,how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.