Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-31-2020, 08:06 PM
Ricko_uk Ricko_uk is offline Pasting and image into input form Windows 10 Pasting and image into input form Office 2019
Novice
Pasting and image into input form
 
Join Date: Aug 2020
Posts: 10
Ricko_uk is on a distinguished road
Default Pasting and image into input form

Hi,
is there a way to create a Excel input form so that I can input data including images BUT in such a way that when I input images, instead of selecting the image from a file I paste it?
Thank you
Reply With Quote
  #2  
Old 08-31-2020, 08:17 PM
Logit Logit is online now Pasting and image into input form Windows 10 Pasting and image into input form Office 2007
Expert
 
Join Date: Jan 2017
Posts: 529
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

This macro will allow you to select the desired image and then paste it to the ACTIVECELL.

You could modify the macro slightly for your purposes (currently it is restricted to L5), then call the macro from your USERFORM. The user will need to select the cell where the image shall be pasted prior to running the macro.

Code:
Option Explicit

Sub ChangeImage()
Application.ScreenUpdating = False

With Range("L5")
    ActiveSheet.Pictures.Delete
End With


    With Application.FileDialog(msoFileDialogFilePicker)
        .AllowMultiSelect = False
        .ButtonName = "Submit"
        .Title = "Select an image file"
        .Filters.Clear
        .Filters.Add "JPG", "*.JPG"
        .Filters.Add "JPEG File Interchange Format", "*.JPEG"
        .Filters.Add "Graphics Interchange Format", "*.GIF"
        .Filters.Add "Portable Network Graphics", "*.PNG"
        .Filters.Add "Tag Image File Format", "*.TIFF"
        .Filters.Add "All Pictures", "*.*"
        
        If .Show = -1 Then
            Dim img As Object
            Set img = ActiveSheet.Pictures.Insert(.SelectedItems(1))
            With Range("L5")
               
                    img.Top = .Top
                    img.Width = 90
                    img.Height = 90
                    img.Left = .Left
                    img.Placement = xlMoveAndSize
                End With
            
            Else
            MsgBox ("Cancelled.")
        End If
    End With
Application.ScreenUpdating = True
End Sub
Reply With Quote
  #3  
Old 09-01-2020, 10:59 AM
Ricko_uk Ricko_uk is offline Pasting and image into input form Windows 10 Pasting and image into input form Office 2019
Novice
Pasting and image into input form
 
Join Date: Aug 2020
Posts: 10
Ricko_uk is on a distinguished road
Default

Thank you very much Logit,

when you say "select the image", what do you mean?

I haven't used macros before but from that code it looks like the image is selected from a file which is exactly the thing I do NOT want to do.

I need to do a screenshot of part of the display then WITHOUT saving it I want to past it directly into some input field/area of a form. But your macro shows opening file dialog box...?
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pasting and image into input form Difference between pasting and inserting an image? puff Drawing and Graphics 4 07-27-2020 07:25 PM
Pasting and image into input form Pasting Image inside Table and Resize Image Not Working Grahamers2002 Drawing and Graphics 5 07-02-2018 04:49 PM
Pasting and image into input form Inserted Image in Form to show larger image on Click tasneemj Word 15 02-11-2018 04:12 PM
Pasting and image into input form Images pasting with icons instead of image Jeffmoonchop Word 2 01-05-2018 08:51 AM
Pasting and image into input form Data Input Form question Cyberseeker Excel 15 04-01-2017 01:03 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:50 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft