Organizer

Syntax

Organizer [.Copy, ] [.Delete, ] [.Rename, ] [.Source = text] [.Destination = text] .Name = text [, .NewName = text] [, .Tab = number]

Remarks

Deletes and renames styles, AutoText entries, toolbars, and macros, and copies these elements between templates. The arguments for the Organizer statement correspond to the options in the Organizer dialog box (Macro command, Tools menu).

Argument

Explanation

.Copy

Copies the specified item from the source to the destination.

.Delete

Deletes the specified item from the source.

.Rename

Renames the specified item in the source.

.Source

The filename of the document or template containing the item you want to copy, delete, or rename. Paths are accepted.

.Destination

The filename of the document or template to which you want to copy the item. Paths are accepted.

.Name

The name of the style, AutoText entry, toolbar, or macro you want to copy, delete, or rename.

.NewName

A new name for the specified item; used with .Rename.

.Tab

The kind of item you want to copy, delete, or rename:

0 (zero) Styles

1 AutoText

2 Toolbars

3 Macros

You also use these values to specify which tab to select when you display the Organizer dialog box with a Dialog or Dialog() instruction.


Note

When you use Organizer to make a change to a file that is not open, Word opens the file in the background, saves changes, and then closes the file. If you need to make a large number of changes, your macro will run faster if it opens the file first, performs the Organizer instructions, and then closes the file using the instruction FileClose 1 to save changes.

Example

This Word macro copies the AutoText entries from the active template to the Normal template. First, the name of the active template is retrieved from the Templates And Add-ins dialog box (Templates command, File menu). If the Document Template text box is blank, indicating the active document is a template, the template's filename is retrieved from the Document Statistics dialog box (Statistics button, Summary Info command, File menu). Then, the number of AutoText entries stored in the active template is returned. Finally, using a For¼Next loop, the Organizer instruction is repeated once for each AutoText entry.


Sub MAIN
Dim dlg As FileTemplates
GetCurValues dlg
template$ = dlg.Template
If template$ = "" Then
    Redim dlg As DocumentStatistics
    GetCurValues dlg
    template$ = dlg.Directory + "\" + dlg.FileName
End If
num = CountAutoTextEntries(1)
If num = 0 Then Goto bye
For count = 1 To num
    Organizer .Copy, .Source = template$, \
        .Destination = "C:\WINWORD\TEMPLATE\NORMAL.DOT", \
        .Name = AutoTextName$(count, 1), .Tab = 1
Next count
bye:
End Sub

See Also

EditAutoText, FileTemplates, FormatStyle, NewToolbar, ToolsMacro