View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] aleptakis@yahoo.gr is offline
external usenet poster
 
Posts: 1
Default pastespecial from excel to existing word doc

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