Microsoft KB Archive/174966

= PRB: DDE With Word 97 Returns 'Ambiguous Name Detected: TmpDDE' =

PSS ID Number: 174966

Article Last Modified on 5/12/2003

-

The information in this article applies to:


 * Microsoft Visual FoxPro for Windows 3.0
 * Microsoft Visual FoxPro for Windows 3.0b
 * Microsoft Visual FoxPro for Windows 5.0
 * Microsoft Visual FoxPro for Windows 5.0a
 * Microsoft Visual FoxPro for Windows 6.0
 * Microsoft FoxPro for Windows 2.5
 * Microsoft FoxPro for Windows 2.5a
 * Microsoft FoxPro for Windows 2.5b
 * Microsoft FoxPro for Windows 2.6
 * Microsoft FoxPro for Windows 2.6a
 * Microsoft Word 97 for Windows

-



This article was previously published under Q174966



SYMPTOMS
When using the DDEExecute function to send a WordBasic command to Word 97 from FoxPro, Visual Basic for Applications returns the following error message:

Ambiguous Name Detected: TmpDDE



CAUSE
This message is returned by Visual Basic for Applications when the Word Global Template (Normal.dot) contains a macro named TmpDDE, and an attempt is made to execute a Word command using the FoxPro DDEExecute function.



RESOLUTION
This problem may be resolved by any of the following methods:
 * Deleting the TmpDDE macro from the MS Word Global Template (Normal.dot) file. -or-


 * Renaming the Microsoft Word Global Template (Normal.dot) file.



STATUS
This behavior is by design.



MORE INFORMATION
When DDEExecute(nChannel,"[WordCommand]") is used to pass a command to Word 97, Word 97 attempts to create a new TmpDDE macro in the Global Template (Normal.dot) file. The TmpDDE macro is released after the Word Command passed by DDEExecute is executed. Word 97 is unable to create the TmpDDE macro if the Global Template (Normal.dot) contains an existing macro of the same name. This behavior is not observed when macros with names other than TmpDDE are present in the Global Template (Normal.dot) file

Steps to Reproduce Behavior
 Open Microsoft Word 97. Create a Word document named Testdoc.doc and save it in the c:\program files\microsoft office\office folder. From the File menu, select Open and select Normal.dot usually located in the c:\program files\microsoft office\templates folder. From the Tools menu, select Macro, and click Macros. In the "Macros in" box of the Macros dialog box, select Normal.dot(global template).</li> Enter TmpDDE in the Macro Name Field.</li> Click Create to open the Visual Basic for Applications Code window.</li> Save the macro.</li> Exit Visual Basic for Applications and Word 97.</li> Open FoxPro for Windows 2.x or Visual FoxPro 3.0x or 5.0x.</li>  Create a program file called test, containing the following code: RUN /n "c:\program files\microsoft office\office\winword.exe" wordchannel = DDEInitiate("Winword","System") docname = "c:\program files\microsoft office\office\testdoc.doc" =DDEExecute(wordchannel, '[FileOpen .name="'+docname+'"]') </li></ol>

<div class="references_section">