Results 1 to 6 of 6

Thread: Resize Image To Excel Window Size And Scale To Fit Automatically

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,401
    Rep Power
    10

    Resize Image To Excel Window Size And Scale To Fit Automatically

    Welcome to ExcelFox jjfletcher

    What you have asked for is very much possible. There may be ways to hook the window using APIs, however if you want to do this using native VBA features in Excel, you will need to use Excel 2013 or above. The code below is just a sample to show you how this can be done in a rudimentary yet very effective way.

    Code:
    Private Sub Workbook_WindowResize(ByVal Wn As Window)
        
        With ThisWorkbook.Sheets(1).Shapes(1)
            .Width = Wn.VisibleRange.Width
            .Height = Wn.VisibleRange.Height
        End With
        
    End Sub
    Attached Files Attached Files
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

Similar Threads

  1. How To Create Medium Size Button In Excel Office Ribbon Tab
    By Ashu2021 in forum Excel Ribbon and Add-Ins
    Replies: 4
    Last Post: 05-12-2014, 11:36 AM
  2. All Excel Files Opening In The Same Window
    By Jorrg1 in forum Excel Help
    Replies: 1
    Last Post: 08-21-2013, 12:14 AM
  3. Replies: 17
    Last Post: 07-15-2013, 09:56 PM
  4. Replies: 2
    Last Post: 04-14-2013, 08:23 PM
  5. Replies: 2
    Last Post: 10-05-2011, 04:18 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •