Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help Please - picture not embedding
Hi
I found the code below (which I've adapted slightly)on OZGrid. I was under the impression this would embed the picture. However having tested it by emailing to someone else it is actually linking the picture (emailed s/sheet has a box saying the linked image cannot be displayed). What I'd like it to do is take the user to a browse to a graphic, embed the graphic in the spreadsheet and resize the graphic. As it stands the macro works perfectly apart from not embedding it. Any help greatly appreciated! Thanks in advance. Steve Sub InsertImageLumindoor1() Dim myFiles, e myFiles = Application.GetOpenFilename(, , , , True) If Not IsArray(myFiles) Then Exit Sub For Each e In myFiles With ActiveSheet With .Pictures.Insert(e) .Left = Range("A20").Left .Top = Range("B20").Top .ShapeRange.LockAspectRatio = msoFalse .Height = 160 .Width = 287 End With End With Next End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help Please - picture not embedding
See if this works for you:
Sub myImageEmbed() Dim fn As Variant fn = Application.GetOpenFilename(FileFilter:="JPEG Files (*.JPG), *.JPG", Title:="Select File To Be Opened") Set myDocument = Worksheets(1) If fn = False Then ' Do nothing if no file selected Else ' Set image position and size here myDocument.Shapes.AddPicture fn, True, True, 100, 100, 70, 70 End If End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help Please - picture not embedding
On Friday, January 15, 2016 at 12:37:33 PM UTC, Robert Crandal wrote:
See if this works for you: Sub myImageEmbed() Dim fn As Variant fn = Application.GetOpenFilename(FileFilter:="JPEG Files (*.JPG), *.JPG", Title:="Select File To Be Opened") Set myDocument = Worksheets(1) If fn = False Then ' Do nothing if no file selected Else ' Set image position and size here myDocument.Shapes.AddPicture fn, True, True, 100, 100, 70, 70 End If End Sub Absolutely spot on! Many thanks Robert. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Connect a number to a picture bank and import that picture to exce | Excel Discussion (Misc queries) | |||
Chart Picture Size in UserForm/Picture Control. | Excel Programming | |||
Delete earlier 'Picture' version when new picture copied in | Excel Programming | |||
insert a picture in to a comment but picture not save on hard disk | Excel Discussion (Misc queries) | |||
embedding picture or object in a cell | Excel Programming |