Open Worddoc from Excel via VBA -> Paste

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi Guys 'n Girls

in one of my Wordtemplates i have following lines:

dim e as excel.application
set e = excel. application

these lines work perfectly, it opens excel and i can
do the stuff that i want. No i want to go vice versa,
i want to do same in Excel:

dim w as word.application
set w = word.application

the reference to the word 10.0 Obj Library has been
set and i'm ready to go...but excel isn't! if i try these
lines, i get an activeX error! Only if i have opened
Word already manually the code works.

What am I doing wrong??

Any Help appreciated

Carlo
 
Dim WRDAPP, WRDDOC
Set WRDAPP = CreateObject("Word.Application")
Set WRDDOC = WRDAPP.Documents.Open("C:\TEST.DOC")
'Or for a new doc:
'Set WRDDOC = WRDAPP.Documents.Add

WRDAPP.Visible = True
'WRDAPP.Quit
 
Thanks moon

moon said:
Dim WRDAPP, WRDDOC
Set WRDAPP = CreateObject("Word.Application")
Set WRDDOC = WRDAPP.Documents.Open("C:\TEST.DOC")
'Or for a new doc:
'Set WRDDOC = WRDAPP.Documents.Add

WRDAPP.Visible = True
'WRDAPP.Quit
 

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

Back
Top