Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Connect a number to a picture bank and import that picture to exce Dennis Hedo Excel Discussion (Misc queries) 1 March 22nd 10 02:17 PM
Chart Picture Size in UserForm/Picture Control. Dan Excel Programming 8 May 30th 08 08:04 PM
Delete earlier 'Picture' version when new picture copied in JDaywalt Excel Programming 1 March 22nd 08 01:23 AM
insert a picture in to a comment but picture not save on hard disk Pablo Excel Discussion (Misc queries) 0 February 21st 07 03:48 PM
embedding picture or object in a cell Roy Ringrose[_2_] Excel Programming 4 July 21st 06 07:37 PM


All times are GMT +1. The time now is 05:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"