ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to open Word from Excel with VBA (Office 2003) (https://www.excelbanter.com/excel-programming/383563-how-open-word-excel-vba-office-2003-a.html)

Daniel Hohenberger

How to open Word from Excel with VBA (Office 2003)
 
Hi.
I'm trying to build a organization chart from data I have in a excel sheet. As I
understand http://support.microsoft.com/default...b/317293/en-us I need to
open Word to create the chart there and then copy'n'paste it to my excel file.

When trying to run the demo code, Excel just aborts without as much as an error
dialog. when debugging, I found out it only goes to the line

Set oCurWorkApplObj = CreateObject("Word.Application")


and then nothing happens. In debugging mode, it just restarts from the beginning
after that line.

Can anyone here give me a hint, what might go wrong or what I might do to find
out what exactly goes wrong?

Thanks in advance,
Daniel

Tom Ogilvy

How to open Word from Excel with VBA (Office 2003)
 
try rebooting your system and trying it.

If word is registered and closed when you run the code, it should work.

It is possible you have started multiple instances of word and they are
taking up all your memory. You can use task manager to see before you
reboot.

--
Regards,
Tom Ogilvy


"Daniel Hohenberger" wrote:

Hi.
I'm trying to build a organization chart from data I have in a excel sheet. As I
understand http://support.microsoft.com/default...b/317293/en-us I need to
open Word to create the chart there and then copy'n'paste it to my excel file.

When trying to run the demo code, Excel just aborts without as much as an error
dialog. when debugging, I found out it only goes to the line

Set oCurWorkApplObj = CreateObject("Word.Application")


and then nothing happens. In debugging mode, it just restarts from the beginning
after that line.

Can anyone here give me a hint, what might go wrong or what I might do to find
out what exactly goes wrong?

Thanks in advance,
Daniel


Daniel Hohenberger

How to open Word from Excel with VBA (Office 2003)
 
Hi Tom,

thank you for the quick response. There were no Word instances running according
to my task manager. I tried rebooting nonetheless, but to no avail.

Word is closed, but I'm not sure what you mean by 'registered'. Do I need to do
this somewhere in VBA? Need I declare the use of Word before using this sub? I'm
sorry if this sounds stupid, I'm a total beginner with VBA, only used to Java and C.

Regards,
Daniel

Tom Ogilvy

How to open Word from Excel with VBA (Office 2003)
 
No, you shouldn't need to register it. If you want to check, go into the VBE
(alt+F11) and go to tools =References and see if Microsoft Word is listed
there. If it is, then it is registered. In fact, create a reference to it.

then in your code you can change

Set oCurWorkApplObj = CreateObject("Word.Application")

to

Set oCurWorkApplObj = new word.Application

http://word.mvps.org/FAQs/InterDev/E...ateBinding.htm

--
Regards,
Tom Ogilvy


"Daniel Hohenberger" wrote:

Hi Tom,

thank you for the quick response. There were no Word instances running according
to my task manager. I tried rebooting nonetheless, but to no avail.

Word is closed, but I'm not sure what you mean by 'registered'. Do I need to do
this somewhere in VBA? Need I declare the use of Word before using this sub? I'm
sorry if this sounds stupid, I'm a total beginner with VBA, only used to Java and C.

Regards,
Daniel


Dave Peterson

How to open Word from Excel with VBA (Office 2003)
 
Just wondering if you looked in the task manager on the Application tab or did
you look for WINWORD.exe on the Processes tab?



Daniel Hohenberger wrote:

Hi Tom,

thank you for the quick response. There were no Word instances running according
to my task manager. I tried rebooting nonetheless, but to no avail.

Word is closed, but I'm not sure what you mean by 'registered'. Do I need to do
this somewhere in VBA? Need I declare the use of Word before using this sub? I'm
sorry if this sounds stupid, I'm a total beginner with VBA, only used to Java and C.

Regards,
Daniel


--

Dave Peterson

Daniel Hohenberger

How to open Word from Excel with VBA (Office 2003)
 
Thanks again,

that did the trick. Now onwards to actually getting the needed data from the xls
and pretty colors ;)

Daniel

--

my homepage : http://hd42.de

'Life is wasted on the living' - Zaphod Beeblebrox the Fourth


All times are GMT +1. The time now is 03:37 AM.

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