pastespecial from excel to existing word doc

A

aleptakis

hi,
im a newbie at excel programming, trying to link an excel cellrange
with an existing word doc, via excel vbeditor.
my code goes like this:

sub paste1()
dim a as object
dim b as string
b="c:\testvb1.doc"
a.documents.open(b)
sheets("sheet1").select
selection.copy
a.selection.pastespecial link:=true, datatype:=wdpasteOLEObject,
placement:=wdinline, displayas icon:=false
end sub

usually i get to open testvb1.doc the first time i run the macro, but
if i try to run it again, i get an error message "the sever is
unavailable or can not be found. I also tried to use arithmetic values
(placement:=0, datatype:=1), but the same problem occurs. Is it
possible that after the first macro run, after i manually close
testvb1.doc it stays active somehow in backround?

Any code examples and suggestions would be valuable for me at this
point

regards
leptakis apostolis
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top