Difference between revisions of "Word UDF"

From AutoIt Wiki
Jump to navigation Jump to search
(Function _WordPropertyGet/-)
(Function _WordPropertyGet/-)
Line 29: Line 29:
  
 
=== Function _WordPropertyGet/- ===
 
=== Function _WordPropertyGet/- ===
Retrieves properties of the Word application.
+
Retrieves application and document properties. Many of the properties for the Options object correspond to items in the Options dialog box.
  
Word object model reference on MSDN:
+
Word object model reference on MSDN for Word 2010:
* [http://msdn.microsoft.com/en-us/library/bb244576%28v=office.12%29.aspx Word 2007]
+
* [http://msdn.microsoft.com/en-us/library/ff841712%28v=office.14%29.aspx Word Application properties]
* [http://msdn.microsoft.com/en-us/library/ff841712%28v=office.14%29.aspx Word 2010]
+
* [http://msdn.microsoft.com/en-us/library/ff821122%28v=office.14%29.aspx Word properties for the Options object]
 +
 
 +
 
 +
Example code to retrieve properties:<syntaxhighlight lang="autoit">
 +
Global $oWord = _Word_Create()
 +
$bVisible = $oWord.Visible ; Returns True when the Word application is visible, else False
 +
</syntaxhighlight>
  
 
=== Function _WordPropertySet/- ===
 
=== Function _WordPropertySet/- ===
  
 
[[Category:UDF]]
 
[[Category:UDF]]

Revision as of 16:13, 1 January 2014

This page is still a work in progress.

The Word UDF offers functions to control and manipulate Microsoft Word documents.

Script breaking changes after AutoIt version 3.3.8.1

New versions of Microsoft Office have been released since the last changes were made to the Word UDF. New file types and new functions needed to be supported, hence the UDF was complete rewritten.

Some functions/parameters have been removed or renamed, new functions/parameters have been added. A detailed list of changes can be found here.

General

All function names have been changed from _Word* to _Word_*.

@extended no longer contains the number of the invalid parameter. The code returned in @error tells exactly what went wrong.

The following list shows the old/new function/parameter name (a "-" is shown if the function/parameter has been removed) and some example scripts how to mimic the behaviour of the "old" UDF. If there is no entry for a removed function/parameter then there is no need for this functionality.

Function _WordCreate/_Word_Create

It's mandatory now to call function _Word_Create. You could use _WordCreate or _WordAttach in the old Word UDF. @extended is set if Word was already running.

Function _WordDocPropertyGet/-

Parameter xx

Function _WordDocPropertySet/-

Function _WordMacroRun/-

A macro can now be run by a single line:

Global $oWord = _Word_Create() 
Global $oDoc = _Word_DocOpen($oWord, @ScriptDir & "\test.doc") 
$oWord.Run("macro_name")

Function _WordPropertyGet/-

Retrieves application and document properties. Many of the properties for the Options object correspond to items in the Options dialog box.

Word object model reference on MSDN for Word 2010:


Example code to retrieve properties:

Global $oWord = _Word_Create() 
$bVisible = $oWord.Visible ; Returns True when the Word application is visible, else False

Function _WordPropertySet/-