Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting GIF's into MS.Excel using VBA

Status
Not open for further replies.

jerstep

Technical User
Mar 22, 2002
18
0
0
AT
Hello All.

I have a "shape" on an Excel worksheet. I need to select this object and copy it within the same workbook but to a different sheet.

If I copy this object into cell A3 for example, I need the top left corner of the image to align exactly within the top left corner of the cell A3.

If I just use selection.paste into A3, then the top left corner of the image appears somewhere else within the cell A3.

I found out that if I insert the object in A3 as a GIF/JPEG file then the top left corner of the image is indeed flush with the top left corner of the cell A3. This I have achieved using Paste Special.

I recorded this macro and it produced:

ActiveSheet.PasteSpecial Format:="Picture (GIF)", Link:=False, DisplayAsIcon:=False

The problem is, however that this code doesn't work when I run it through the VBA editor. I get an error message "cannnot insert data".

Does anyone know how to help me ?

Thanks in advance, James.

 
try instead of activesheet, useing the name of teh sheet you want it on ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top