VBA Word.Selection.Copy not working correctly -


i have problem can't seem wrap head around. i'm trying populate userform using shapes (images) word-document. use code so:

ishapecount = wrddoc.shapes.count = 0  if ishapecount > 0      redim opic(ishapecount - 1) ipicturedisp          each wrdshape in wrddoc.shapes             wrdshape                 wrddoc.activate                 .select                 wrdappmain.activedocument.activewindow.selection.copy                 set opic(i) = pastepicture(lpictype)         end          = + 1          next wrdshape  end if 

with opic being one-dimentional array of pictures , pastepicture being subroutine copied image off of clipboard , array image-file.

so far good.

this works should, there more 2 shapes (images) present in word-document, copy-command copies first 2 charm, other ones (although correctly selected) not copied copy-command copying literally nothing.

another funny thing: if leave out wrdappmain.activedocument.activewindow.selection.copy-thingy , manually ctrl-c shape selected programm goes through loop, works no matter how many shapes there in word-document.

so see: i'm @ end of rope here. please :)

thank in advance!

why don't give shape opic-array?

ishapecount = wrddoc.shapes.count  if ishapecount > 0      redim opic(ishapecount - 1) ipicturedisp      = 0 (ishapecount -1)         each wrdshape in wrddoc.shapes             opic(i) = wrdshape         next wrdshape     next  end if 

opic declared variant.


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -