+ Reply to Thread
Results 1 to 4 of 4

Insert image and lock aspect ratio

  1. #1
    Registered User
    Join Date
    08-28-2018
    Location
    London
    MS-Off Ver
    365 Subscription
    Posts
    8

    Insert image and lock aspect ratio

    Hi,

    May I know how to lock aspect ratio by using below code:


    Sub InsertPicFromFile()
    Dim xRg As Range
    Dim xCell As Range
    Dim xVal As String
    On Error Resume Next
    Set xRg = Application.InputBox("Please select file path cells:", "Insert Imagesl", Selection.Address, , , , , 8)
    If xRg Is Nothing Then Exit Sub
    Application.ScreenUpdating = False
    For Each xCell In xRg
    xVal = xCell.Value
    If xVal <> "" Then
    ActiveSheet.Shapes.AddPicture xCell.Value, msoFalse, msoTrue, _
    xCell.Offset(0, 1).Left, xCell.Top, xCell.Height, _
    xCell.Height
    End If
    Next
    Application.ScreenUpdating = True
    End Sub

    Thanks!

  2. #2
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,498

    Re: Insert image and lock aspect ratio

    Could you be so kind and read the "Forum Rules" again and act on #2.
    Thank you very much

  3. #3
    Registered User
    Join Date
    08-28-2018
    Location
    London
    MS-Off Ver
    365 Subscription
    Posts
    8

    Re: Insert image and lock aspect ratio

    Hi,

    May I know how to lock aspect ratio by using below code:
    Please Login or Register  to view this content.
    Thanks!

  4. #4
    Registered User
    Join Date
    08-28-2018
    Location
    London
    MS-Off Ver
    365 Subscription
    Posts
    8

    Re: Insert image and lock aspect ratio

    Following code can LockAspectRatio but cannot fit the cell height...
    Any suggestion?

    Please Login or Register  to view this content.

+ 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] Locking ASPECT RATIO code after embedding an Image ??
    By hans302 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-09-2019, 11:59 PM
  2. [SOLVED] Lock Aspect Ratio
    By JoakimBugge in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-05-2018, 09:25 AM
  3. Replies: 3
    Last Post: 12-07-2012, 04:54 PM
  4. Insert picture changes uses smaller aspect ratio
    By lakecityransom in forum Excel General
    Replies: 2
    Last Post: 11-01-2011, 06:18 PM
  5. Lock Aspect Ratio of objects on a workbook sheets
    By JIBG in forum Excel General
    Replies: 0
    Last Post: 09-12-2007, 09:10 AM
  6. Replies: 0
    Last Post: 02-12-2006, 02:15 AM
  7. [SOLVED] Aspect ratio of image differs in print
    By Monika Bjurman in forum Excel General
    Replies: 1
    Last Post: 04-28-2005, 08: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