ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Open Worddoc from Excel via VBA - Paste (https://www.excelbanter.com/excel-programming/373241-open-worddoc-excel-via-vba-paste.html)

Carlo

Open Worddoc from Excel via VBA - Paste
 
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

moon[_7_]

Open Worddoc from Excel via VBA - Paste
 

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




"Carlo" schreef in bericht
...
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




Carlo

Open Worddoc from Excel via VBA - Paste
 
Thanks moon

"moon" wrote:


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




"Carlo" schreef in bericht
...
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






All times are GMT +1. The time now is 04:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com