Excel VBA: Copying Pictures from image controls to activeX objects -


i have series of images need display multiple times on both forms (via image controls) , on worksheets (via activex image controls). know keep files externally , use loadpicture method; there want avoid if possible.

i know save , load- again rather not use external file write perform task. ideally, stay embedded , hidden within file itself.

i think there maybe solution in using clipboard- couldn't syntax work. object embedded in same location(s); never moves or changes size or other properties (beyond .visible). simple like;

sheet1.oleobjects("toimage").object.picture = frm1.fromimage.picture 

**edit: **
think i've found solution this; still have related question.

i worked out want if embed series of activex images on sheet; reference them in actual controls / objects want. so;

sheet1.oleobjects("toimage").object.picture=sheet1.oleobjects("fromimage").object.picture 

or

frm1.controls("toimage").picture = sheet1.oleobjects("fromimage").object.picture 

but, below doesn't work when try same using inserted picture (a shape object);

frm1.toimage.picture =  sheet1.shape("fromimage").picture 

..isn't valid syntax. seems thing can them copy them- couldn't use them set picture of object without using clipboard.

the solution above works me (using series of activex image objects rather pictures)- curious why can't using standard picture (shape).

if want add picture excel sheet use this:
(you can change activesheet favorite sheet)

dim asheet worksheet dim ashape shape set asheet = activesheet set ashape = asheet.shapes.addpicture("<filename>", msofalse, msotrue, 120, 120, 200, 200) 

and more details :

function addpicture(filename string, linktofile msotristate, savewithdocument msotristate, left single, top single, width single, height single) shape

function addpicture2(filename string, linktofile msotristate, savewithdocument msotristate, left single, top single, width single, height single, compress msopicturecompress) shape


and if want load picture image component on form :
(add image component form [: image1])

set image1.picture = loadpicture("<filename>") 

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -