Search the Community
Showing results for tags 'udf _word_doctablewrite'.
-
within the AutoIt Help (v.3.3.14.2), there is an example script showing how to use UDF _Word_DocTableWrite, (shown here): >>>>> #include <MsgBoxConstants.au3> #include <Word.au3> ; Create application object Local $oWord = _Word_Create() If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Word UDF: _Word_DocTableWrite Example", _ "Error creating a new Word application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) ; Open the test document Local $oDoc = _Word_DocOpen($oWord, @ScriptDir & "\Extras\Test.doc", Default, Default, True) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Word UDF: _Word_DocTableWrite Example", _ "Error opening '.\Extras\Test.doc'." & @CRLF & "@error = " & @error & ", @extended = " & @extended) ; ***************************************************************************** ; Write the content of a 0-based two dimensional array to a Word table ; ***************************************************************************** Local $asArray[3][3] = [[1, 2, 3], ["a", "b", "c"], ["x", "y", "z"]] Local $oRange = _Word_DocRangeSet($oDoc, -2) _Word_DocTableWrite($oRange, $asArray, 0) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Word UDF: _Word_DocTableWrite Example", _ "Error creating the table." & @CRLF & "@error = " & @error & ", @extended = " & @extended) MsgBox($MB_SYSTEMMODAL, "Word UDF: _Word_DocTableWrite Example", _ "Table successfully added to the end of the document.") <<<<< When running this on my machine (Windows 7 Pro and Word 2016), the script returns the following error box: Error creating the table. @error = 3, @extended = -2147352567 Apparently, within the UDF, an attempt to set the .Text value for the object range is passing back this strange error code. $oRange.Text = $sData I seem to recall similar Office Automation COM error in the past, but don't recall what caused it or the solution. Anyone have any idea or suggestions on getting past this error?