LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Use Template to open word document

I want to open a word document based on a template. I am using the following statements to do it, but get a type error. The ECG_REPORT_TEMPLATE is a text string of the filename.
error = CA_VariantSetCString (&wdECGTemplateVt, ECG_REPORT_TEMPLATE);

error = Word_DocumentsAddOld (docsHandle, NULL, wdECGTemplateVt,
CA_DEFAULT_VAL, &docHandle);

Is this the right function? Is there a more comprehensive description of the Word Object model available to figure out what these are and how to use the functions from LabWindows/CVI? Most the documentation is for VB and .Net on MS site.
0 Kudos
Message 1 of 2
(2,597 Views)
Trillian,

Here is link from Microsoft's website with the Word 2000 object model (and in fact this has the object models for all office 2000 applications as well).

http://www.microsoft.com/resources/documentation/office/2000/all/solution/en-us/appendixes/partapp.mspx

Microsoft touts this as a VB object model, but in my experience with using MS Office ActiveX controls in LabWindows/CVI (In particular Visio 2003) these object models are just as useful for C as they are for VB.

Also, are you using a relative path for your template? I know in Visio, the path must be absolute when I load files otherwise an error was returned, so perhaps that is where your error is coming from. In order to simulate a relative path I kept the Visio file in a path relative to my executable and used the GetProjectDir() function to get the current directory the executable was in. From there I used strcat to build an absolute path from what is in reality a relative path.
0 Kudos
Message 2 of 2
(2,591 Views)