• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Badly Needed Help: Fix for this code to insert image as embedded..Not as Link

Code:
Code (vb):

Sub Insert_Picture2()
Dim lThisRow As Long, n As String, anyShape As Shape, l As Single, t As Single
Application.ScreenUpdating = False
                  lThisRow = 18
With ActiveSheet
   Do While .Cells(lThisRow, 18).Value > ""
       With .Cells(lThisRow, 18)
            l = .Offset(, 2).Left
            t = .Top
            n =\\PicLocation\" & .Text
        End With
        If Dir(n) > "" Then
            With .Pictures.Insert(n)
                With .ShapeRange
                    .LockAspectRatio = msoFalse
                              .Height = 145
                              .Width = 100
                            .Rotation = 0
                End With
                      .Top = t
                    .Left = l
                .Placement = 1
            End With
        End If
        lThisRow = lThisRow + 1
    Loop

    .Range("R20").Select
End With

Application.ScreenUpdating = True
MsgBox "Pic Inserted!"
End Sub

Hi i badly needed help for this code..
This code is inserting image to excel but a link hence when i send the excel to others they cannot see the inserted pictures.

Can someone modify this code that instead of inserting pictures as link.. the pictures should be copy paste or be embedded inside the excel itself not as a link..
 
Hi !

Activate the Macro Recorder and operate manually just
selecting the right option : you will get your own code base ! EZ

As on my side Pictures.Insert does not create a link …
 

Thanks for not quoting the whole just previous post as it's just clutter !

Again : on my side Pictures.Insert well creates an embedded image
as I tried on different Excel versions via Macro Recorder,
so nothing to fix …
 
Thanks for not quoting the whole just previous post as it's just clutter !

Again : on my side Pictures.Insert well creates an embedded image
as I tried on different Excel versions via Macro Recorder,
so nothing to fix …
hi .. actually i used this code but when i tried to send the excel to others it showing cannot show image..link has been removed and also when i check the excel size..its not changing.. it means code above just link the picture but not put in excel..
 
hi .. actually i used this code but when i tried to send the excel to others it showing cannot show image..link has been removed and also when i check the excel size..its not changing.. it means code above just link the picture but not put in excel..
Thanks for not quoting the whole just previous post as it's just clutter !
Workaround : use Shapes.AddPicture method, to see in VBA inner help …
 
Well follow sample of VBA inner help (as explained)
and see also the link given by Narayan in your previous thread …

I tried both on my side and they work !
But on some recent Excel version, Pictures.Insert may add a link;
on older version, the image is embedded …

So two choices : manual insertion or
use the workaround Narayan and I gave you.
 
Code:
If Dir(n) > "" Then
            With .Pictures.Insert(n)
                With .ShapeRange
                    .LockAspectRatio = msoFalse
                              .Height = 118
                              .Width = 112
                            .Rotation = 0
                End With

Hi need help, after inserting image with this code, Macro must copy and paste it, so that it will not remove when opening to other pc, can someone modifiy this code like copy and pasting the image after inserting it..
Thanks in advance
 
Back
Top