As Benjamin said, CF Comet is a great place for this type of work.  But I 
didn't see code there that would address your needs, so here is some *untested* 
code along with some tips for CF's odd implementation of COM.

-David

After the CFOBJECT tag, do your work in a CFSCRIPT block.
Don't try to go more than one level deep in an object on any single line of 
code.

<CFSCRIPT>
objDocs = objWord.Documents;  // get the Documents collection
objDoc = objDocs.Add;  // add a new doc to the Documents collection
objRange = objDoc.Range(0,0);  // get the range object at the start of the new 
doc
objTables = objRange.Tables;  // get the range's Tables collection
objTable = objTables.Add(3,4);  // add a table
</CFSCRIPT>

You may need to use Val(0) instead of 0, Val(3) instead of 3, etc.


On Tuesday, August 21, 2001 7:51 AM, Joao Luiz de Brito Macaiba 
[SMTP:[EMAIL PROTECTED]] wrote:
> Hi,
>
>       I'm trying to create a table in a msword97 document using COM.
>
> In 'Microsoft Word Visual Basic' help I see the example below:
>
> 
------------------------------------------------------------------------------
> --
> Set myRange = ActiveDocument.Range(0, 0)
> ActiveDocument.Tables.Add Range:=myRange, NumRows:=3, NumColumns:=4
> 
------------------------------------------------------------------------------
> --
>
> By that I can suppose I can use :
>
> <!--- begin code --->
>
> <CFObject
> Action="Connect" Class="Word.Application" Name="objWord" Type="COM">
>
> myDoc = objWord.Documents.Add();
>
> myDocTable = myDoc.Tables.Add(myDoc.Range(0),3,2);
>
> <!--- end code --->
>
>
> But I receive the following error :
>
>
> Error Diagnostic Information
>
> Failed attempting to find "TABLES.ADD" property/method on the object
>
> COM error 0x80020006. Unknown name.
>
>
> Does anyone know what is going wrong ?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to