Results 1 to 4 of 4

Thread: Problem sizing jpg in Excel using VBA

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2005
    Posts
    6

    Problem sizing jpg in Excel using VBA

    Hi all,

    I am inserting a picture, then resizing it to be the correct size. After resizing, the user must choose one of the 4 options represented in the picture. Unfortunately, I have a problem here, because the sizing of the picture does not work if I run the program. The result is that the picture is too small for
    the user to identify the 4 options. Why doesn't the sizing work?

    I hope I explained the problem clearly enough. If you have questions, just post them.

    Yours truly,

    Berend Botje

    P.s. Here is the code I use:


    Sub RotatieSelectie(Unit As String)
    Dim WSActive As Worksheet
    Dim i As Integer

    Set WSActive = ActiveSheet
    PictureSheet.Activate
    ActiveSheet.Pictures.Insert("C:\MyDir\Picture1.jpg").Select
    Call SizePicture
    Rotatiehoek = InputBox("Choose please. (1-4)", "Choose", "1", 400)
    WSActive.Activate
    Set WSActive = Nothing
    End Sub

    Sub SizePicture
    Selection.ShapeRange.Height = 300
    End Sub
    Last edited by Berend Botje; Jul 5th, 2005 at 06:32 AM.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Problem sizing jpg in Excel using VBA

    Post your "Call SizePicture" procedure code.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2005
    Posts
    6

    Re: Problem sizing jpg in Excel using VBA

    It is already there, at the end of my original post:

    Sub SizePicture
    Selection.ShapeRange.Height = 300
    End Sub

    Since I did not remove the Height-Width ratio lock, I only need to change the Height to size the picture.

  4. #4

    Thread Starter
    New Member
    Join Date
    Jul 2005
    Posts
    6

    Re: Problem sizing jpg in Excel using VBA

    Solved my own problem

    Application.ScreenUpdating = False
    Selection.ShapeRange.Height = 300
    Application.ScreenUpdating = True

    This works nicely.
    Last edited by brad jones; Jul 7th, 2005 at 01:46 PM. Reason: Advertising link removed by admin

Posting Permissions

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



Click Here to Expand Forum to Full Width