Results 1 to 1 of 1

How to incorporate images into user form - Part 2

Threaded View

  1. #1
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    How to incorporate images into user form - Part 2

    Hi, I'm trying to activate an image in my image box when I select a product from my Combo box1 but here's where my limitations kick in. I've got some basic code but I imagine its full of errors. The basic functioning asks the ComboBox1 to access a directory of pictures and load them into ImageBox called Image1. Any assistance would be greatly appreciated.
    Here's the code:


    Private Sub pict()
        Image1.Picture = LoadPicture("\SVR2\Data\Common Folders\Technical & QA\CAD\IMAGES FOR LABELS\QR Codes" & ComboBox1)
    End Sub


    Sub Pictotal()
    Dim picname As String
        
        Image1.Select 'This is where picture will be inserted
    
        picname = ComboBox1 'This is the picture name
      
        On Error Resume Next
        'delete previous pic
        ActiveSheet.Pictures("Picture").Delete
        Err.Clear
        Err.Number = 0
        On Error GoTo 0
          On Error Resume Next
        MsgBox "image test"
        
        If (Dir("\SVR2\Data\Common Folders\Technical & QA\CAD\Images for labels\QR Codes" & picname & ".png") = vbNullString) Then Exit Sub
        
       ActiveSheet.Pictures.Insert("\SVR2\Data\Common Folders\Technical & QA\CAD\Images for labels\QR Codes" & picname & ".png").Select
    
       
       'Path to where pictures are stored
        '''''''''''''''''''''''''''''''''''''''''''''''''''''''
        ' This resizes the picture
        '''''''''''''''''''''''''''''''''''''''''''''''''''''''
        With Selection
            .Name = "Profile"
            .Left = Range.Image1.Left * 7.5
            .Top = Range.Image1.Top * 1.27
            .ShapeRange.LockAspectRatio = msoTrue
            .ShapeRange.Height = 130#
            .ShapeRange.Width = 130#
            .ShapeRange.Rotation = 0#
        End With
    
        
    End Sub
    Last edited by bralew; 09-08-2016 at 06:19 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] How to incorporate images into user form.
    By bralew in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-08-2016, 03:45 AM
  2. [SOLVED] User Form to execute search and return all values to the user form for editing
    By allwrighty in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-11-2013, 10:40 PM
  3. [SOLVED] Excel user form- If/Then statement outcome to show on user form
    By PANTECH in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-18-2013, 09:16 AM
  4. Find Part of cell value from User form
    By mhuddles1981 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-19-2010, 09:56 PM
  5. Need a VBA Code for fliping images in a User Form
    By daksh1981 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-10-2009, 03:58 PM
  6. [SOLVED] Printing Part of User Form
    By mully in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 05-26-2005, 03:22 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