0 votes
in VBA by Expert (916 points)

Hello everyone

It seems the question is simple but I couldn't figure it out,

I need to insert a picture without resizing the picture and the insertion would be at specific cell as start point.

What I have found is to insert picture 

With ActiveSheet.Pictures.Insert(sPath)
    .Left = 110
    .Top = 220
    .Width = 123
    .Height = 134
End With

But I don't want to change any property that's a point. Another one is to specify a cell to be the first cell for the inserted picture

1 Answer

+2 votes
by Expert (911 points)
selected by
Best answer

Try this:

With ActiveSheet.Pictures.Insert(sPath)
    .Left = rCell.Left
    .Top = rCell.Top
    .Placement = xlMove
End With

where rCell is the first cell for the inserted picture.

Here is the XlPlacement Enum:
xlFreeFloating = 3, Object is free floating.
xlMove = 2, Object is moved with the cells.
xlMoveAndSize = 1, Object is moved and sized with the cells.

by Expert (916 points)
Thank you very much for this perfect solution ..

Simple and working well as expected

Welcome to wellsr Q&A
Ask any questions you have about VBA and Python and our community will help answer them. wellsr Q&A is the standalone question and answer platform for wellsr.com. If you have a question about one of our specific tutorials, please include a link back to the tutorial.

Getting Started
VBA Cheat Sheets (On Sale Now)

Looking for something else? Hire our team directly through ourVBA Help page, instead.

For more programming tips visit the VBA Tutorials Blog and the Python Tutorials Blog.