Creating a Word Macro and associating it with a file or template

btn_mini.gif Click here to see a numbered graphic illustrating the following procedure.

The first step in running DECtalk Software from a Microsoft Word document is creating the Word macro that links Word and DECtalk through the Dynamic Data Exchange (DDE) server. You only have to create this macro once and associate it with a button, hot key, or menu command. If you make the macro part of a permanent .dot (template) file, DECtalk Software will always be available when you edit a document associated with that template.

To create a Word macro:

Task/Location

 

Action

Result

Word dialog

Step 1

Select Macro from the Tools Menu. (1)

The Macro dialog box is displayed. (2)

Macro dialog box (2)

Step 2

Enter the name of the macro you are going to create. (3)

 

Macro dialog box (2)

Step 3

Click the Create button. (4)

The Macro creation window is displayed.(5)

Macro creation window (5)

Step 4

Insert the following macro: (Note: you can open the word.txt file located in the \DECTALK\ directory, copy it, and paste it into the Word macro.)

Sub MAIN

If AppIsRunning("TTSsrv") = 0 Then

Shell "TTSSRV.EXE", 0

rightNow = Now()

diffTime = 0

Print "Starting DECtalk Server"

WaitCursor 1

While diffTime < 0.00003

diffTime = Now() - rightNow

Wend

WaitCursor 0

Print " "

If AppIsRunning("TTSsrv") = 0 Then

MsgBox("Cannot find TTSSRV.EXE in the path", "Speak", 0)

Goto FINIS

End If

End If

channel = DDEInitiate("TTSserver", "Speak")

If channel = 0 Then

MsgBox("Unable to connect to TTSSRV.EXE", "Speak", 0)

Goto FINIS

Else

DDEPoke channel, "Speak", Selection$()

DDETerminate channel

FINIS:
End Sub

File pull-down menu.

Step 5

On the File menu, click Close (6). Click Yes (7) when you are asked if you want to keep changes to the macro.

The macro is created.

 

btn_mini.gif Related topics