LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot create new Word document !!!!!!

Hi Dave,

Before I try what you suggested - I only have Microsoft Word 9.0 object library.

Is it important to have version 10.0? If so, how can I get it? Is it downloadable?

Thanx!

---J

0 Kudos
Message 11 of 20
(1,817 Views)

Hi Jojo,

The object library that you have should depend on the version of Office that you have installed on your machine.  When you say you only have word9.0 do you mean that is the only object library you are able to see/build from 'Tools->Create ActiveX Controller' menu, or do you mean that is the only one that you physically have built on your machine?

When you install Word 2002 it should automatically register the 10.0 object library.   The way you can get this object library on your machine is to go to 'Tools->Create ActiveX Controller'.  You can select the MS Word 10. object library and build it from there.  At some point you must have had this object library built because you mentioned the 'Word_ApplicationGetDocuments' that you cannot find, which is a function present in the 10.0 object library and not the 9.0 object library.

I know at one point you had uninstalled Word 2002 and only had word 2000 on the machine, is this still the case?

0 Kudos
Message 12 of 20
(1,807 Views)
Hi Dave,
 
Currently there is only version 9.0 in my 'Tools->Create ActiveX Controller' menu.
 
I used to have Office 2002, but then you reccomended that I try working with Office 2000 to solve the problem. so I uninstalled it. I could go back to Office 2002 if you think it's better..
 
Please let me know.
 
Sincerely,
JM
0 Kudos
Message 13 of 20
(1,795 Views)

Hi Jojo,

Well, this problem just keeps getting trickier and tricker :-). 

I think that you should be fine with the 9.0 controls as long as you have word 2000 or before.

1.) In the HRESULT CVIFUNC WordRpt_DocumentNew(CAObjHandle appHandle, char template[], CAObjHandle *docHandle) function, what do you pass in as a value for 'template' argument?

2.) Have you tried running the word2000demo that comes with labwindows and seen if it works?  If it does, try using the following code in your program.  For right now, just comment out any functions coming from the WordReport .fp right now, and lets see if we can get this to work without it (WordReport is basically just a bunch of wrapper classes for the Word9.0 object library anyway):


//Open Word

Word_NewApplication (NULL, 1, LOCALE_NEUTRAL, 0, &appHandle);

//Make word visible

Word_SetProperty (appHandle, NULL, Word_ApplicationVisible,
                                CAVT_BOOL, VTRUE)

//Get the word documents handle

Word_GetProperty (appHandle, NULL,
                                            Word_ApplicationDocuments,
                                            CAVT_OBJHANDLE, &docsHandle);

//Add the new word document

Word_DocumentsAddOld (docsHandle, NULL, CA_DEFAULT_VAL,
                                               CA_DEFAULT_VAL, &docHandle)
    


Message Edited by DaveC on 08-19-2005 03:38 PM

0 Kudos
Message 14 of 20
(1,782 Views)

Hi Dave,

We've made progress!!! congradulations Smiley Very Happy

I checked the "template" parameter, and I remembered you once told me that the filename should contain an absolute path, so I altered it, and now I am successful in opening the document!

However, there is still a problem: My document conatins tables, and I keep getting this error string-- "No such interface supported"

So I looked into it, and I found that there is a call to the function: WordRpt_SetRowHeight, (from within WordRpt_InsertCVITable)

This function contains the call:

    errChk (Word_RowsSetHeight (rowHandleL, NULL, newRowHeight,
                                WordConst_wdRowHeightExactly));

This call returns the error code I mentioned above.

Hope you have more ideas...

Anyway, congrats again 🙂

Message Edited by Jojo9999 on 08-21-2005 04:58 AM

0 Kudos
Message 15 of 20
(1,772 Views)

PS

I'm now working with office XP

0 Kudos
Message 16 of 20
(1,767 Views)
Hi Again!
 
(Sorry for all the replies, for some reason, I can't edit my messages...)
I tried adding comments before the lines containing the Word_RowsSetHeight call.
 
What I got is an error from within the function: WordRpt_WriteToCell
 
The error occurs in the line:
errChk(Word_SelectionSelect (cellHandleL, NULL));
 
---JM
 
 
0 Kudos
Message 17 of 20
(1,755 Views)
Hey JM,
 
Congrats on getting this thing to start working again!. 
 
Looking at the API for 'Word_SelectionSelect' it says it is a method that can be applied to a row, field, or range object.  It looks like the handle you are passing in is a cell object handle.  Depending on what you want to select you might want to try passing a different handle into the 'Word_SelectionSelect', or using a different function altogether. 
 
 If you want the program to select a single cell within the table, I would try using the 'Word_SelectionSelectCell (cellHandleL, NULL)' function.  If you want the program to select an entire row within the table, I'd try 'Word_SelectionSelect (rowHandleL, NULL)' and see if that works.
0 Kudos
Message 18 of 20
(1,740 Views)

Hi, Dave

Well, I succeeded!!!

It was much thanks to you!

To sum up, here are the main fixes required:

1. The path of the template file (which I'm opening with word) had to be absolute

2. I used an older version of Wordreport.c (function starting with WordRpt_), so although it compiled okay, many functions (such as RowSetHeight) returned an error. Had to get a newer version of WordReport (came with the new CVI). ALWAYS USE THE DEMO (was my conclusion)

3. There was no need to re-create the ActiveX object for Office XP. The one for Word2000 was enough.

So, Thanx very much! Smiley Very Happy

JM

P.S

I have a new problem with Excel , So I'm starting a new thread. Happy if you can help there too.

Message Edited by Jojo9999 on 08-28-2005 02:38 AM

Message Edited by Jojo9999 on 08-28-2005 02:38 AM

0 Kudos
Message 19 of 20
(1,711 Views)
Glad to help.  See you in the next thread 🙂
0 Kudos
Message 20 of 20
(1,684 Views)