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