Word DDE call ignored

239 views Asked by At

I am calling from my C++ code two DDE commands:

FormDde->DdeClientConv1->ExecuteMacro("[AddAddIn \"C:\\Projects\\wscs-trunk\\bin\\ws.dot\", 1][FileOpen .Name = \"C:\\Projects\\wscs-32x\\doc\\MyDoc.doc\]",false)
FormDde->DdeClientConv1->ExecuteMacro("[ToolsMacro .Name = \"FillTemplateAttests\", .Run]", false)

First command open template ws.dot and document MyDoc.doc. Template ws.dot contains macro FillTemplateAttests which I try to execute in second DDE command call. These two commands were functioning correctly more than 3 months. A few days ago second command interrupted functioning. I havent change anything in this part of code or in macro FillTemplateAttests. Interrupted functioning means that when I call second command nothing happens even when ExecuteMacro call returns true (which means all should be OK according to documentation). When I run the same program with the same documents ws.dot and MyDoc.doc on another computer all is OK. When I call the second command twice it is actually executed (but only once - first call is ignored):

FormDde->DdeClientConv1->ExecuteMacro("[AddAddIn \"C:\\Projects\\wscs-trunk\\bin\\ws.dot\", 1][FileOpen .Name = \"C:\\Projects\\wscs-32x\\doc\\MyDoc.doc\]",false)
FormDde->DdeClientConv1->ExecuteMacro("[ToolsMacro .Name = \"FillTemplateAttests\", .Run]", false)
FormDde->DdeClientConv1->ExecuteMacro("[ToolsMacro .Name = \"FillTemplateAttests\", .Run]", false)

It seems to me like Word installation is broken. Could you help to find me the core of problem?

ADDENDUM:

When I call these 3 commands in row, all of them are executed:

FormDde->DdeClientConv1->ExecuteMacro("[AddAddIn \"C:\\Projects\\wscs-trunk\\bin\\ws.dot\", 1][FileOpen .Name = \"C:\\Projects\\wscs-32x\\doc\\MyDoc.doc\]",false)
FormDde->DdeClientConv1->ExecuteMacro("[Beep]", false);
FormDde->DdeClientConv1->ExecuteMacro("[ToolsMacro .Name = \"FillTemplateAttests\", .Run]", false)
1

There are 1 answers

0
truthseeker On BEST ANSWER

This solved my problem even when I don't know why:

FormDde->DdeClientConv1->ExecuteMacro("[AddAddIn \"C:\\Projects\\wscs-trunk\\bin\\ws.dot\", 1][FileOpen .Name = \"C:\\Projects\\wscs-32x\\doc\\MyDoc.doc\]",false)
FormDde->DdeClientConv1->ExecuteMacro("[]", false);
FormDde->DdeClientConv1->ExecuteMacro("[ToolsMacro .Name = \"FillTemplateAttests\", .Run]", false)