+ Reply to Thread
Results 1 to 3 of 3

how to make command button to insert picture

Hybrid View

sspreyer how to make command button to... 08-07-2013, 06:06 PM
AlvaroSiza Re: how to make command... 08-08-2013, 12:59 AM
sspreyer Re: how to make command... 08-08-2013, 04:45 AM
  1. #1
    Forum Contributor sspreyer's Avatar
    Join Date
    07-05-2013
    Location
    london
    MS-Off Ver
    Excel 365 enterprise
    Posts
    191

    how to make command button to insert picture

    hi everyone

    i would like to make command button open file directory and then let user pick picture . add picture spercifix size eg 10cm by 10cm

    thanks in advance

  2. #2
    Valued Forum Contributor AlvaroSiza's Avatar
    Join Date
    09-19-2007
    Location
    Staffordshire
    MS-Off Ver
    2007
    Posts
    591

    Re: how to make command button to insert picture

    Something like this. *Note* The values used in resizing were arbitrary and for demonstration only. You will need to play with them to find the size and location of the inserted picture you are after.

    Hope this helps,

    Sub PicInsert()
    Dim fName As Variant
    
        fName = Application.GetOpenFilename(FileFilter:="Pic Files (*.jpg;*.bmp), *.jpg;*.bmp", Title:="Select a Picture", MultiSelect:=False)
        If fName <> False Then
            ActiveSheet.Pictures.Insert(fName).Select
            With Selection.ShapeRange
                .ScaleWidth 0.44, msoFalse, msoScaleFromTopLeft
                .ScaleHeight 0.44, msoFalse, msoScaleFromBottomRight
                .IncrementLeft -143.25
                .IncrementTop -222.5466
            End With
        End If
    
    End Sub
    Perhaps it was the Noid who should have avoided me...
    If you are satisfied with my solution click the small star icon on the left. Thanks
    1. Make a copy of your workbook and run the following code on your copy (just in case)
    2. With excel open, press ALT+F11 to open the Visual Basic Editor (VBE). From the "Insert" menu, select "Module".
    3. Paste the code from above into the empty white space. Close the VBE.
    4. From the developer tab, choose "Macros", select the Sub Name, and click "Run".

  3. #3
    Forum Contributor sspreyer's Avatar
    Join Date
    07-05-2013
    Location
    london
    MS-Off Ver
    Excel 365 enterprise
    Posts
    191

    Re: how to make command button to insert picture

    Thanks for your help

+ 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. how to make command button insert picture in range of cells
    By sspreyer in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-08-2013, 01:51 AM
  2. Command button to change picture link
    By sumonrezadu in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-28-2013, 04:19 AM
  3. [SOLVED] How to make a Command button run the "FORM" command to fill/populate a table?
    By jrobin7 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-21-2012, 12:26 PM
  4. Change picture with command button
    By sumonrezadu in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-21-2012, 09:46 PM
  5. Linked picture changed by command button
    By sumonrezadu in forum Excel General
    Replies: 0
    Last Post: 06-11-2012, 04:28 AM

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