Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

This question is tough. Error: Ambiguous name detected: TmpDDE

Status
Not open for further replies.

Amy998

IS-IT--Management
Mar 28, 2001
8
US
Hi,
I just converted an Access database from 2.0 to 97, There is a problem I don't know how to
solve, need somebody help me. I have a function like this:

Function MergeModifyWord(FileName As String, ClaimNumber As String, LetterCode As
String)
On Error GoTo MergeModifyWord_Err
Dim Channel As Variant, Q As String, MergeCmd2 As String Dim MergeCmd As String
Dim Retval As Variant, MergeCmd3 As String

FileName = UCase$(FileName)
Q = Chr$(34)
MergeCmd = "[FileClose 2]"
MergeCmd2 = "[FilePrintMergeToDoc]"
MergeCmd3 = "[Activate """ & FileName & """]"
DDETerminateAll
Channel = DDEInitiate("WINWORD", "System")
DDEExecute Channel, MergeCmd2
DDEExecute Channel, MergeCmd3
DDEExecute Channel, MergeCmd
DDETerminate Channel
Retval = SaveLetter(LetterCode, ClaimNumber)
MergeModifyWord = True

MergeModifyWord_Exit:
Exit Function

MergeModifyWord_Err:
MsgBox "Error: " + Error$, 0, "MergeModifyWord"
Resume MergeModifyWord_Exit

End Function
When the code run to "DDEExecute Channel, MergeCmd2", it will appare a message said,
Ambiguous name detected: TmpDDE. I was told, If I deleted the TmpDDE Macro from
Microsoft Word' Tools->Macro->Macros or renamed the Normal.dot file,it would work fine. I
did these, but there is another problem appear, when I run the code from Access, and when it run
to "DDEExecute Channel, MergeCmd2", the Visual Basic Editor come out with a Sub like this
Sub TmpDDE()
Dim FilePrintMergeToDoc
FilePrintMergeToDoc
End Sub
The "FilePrintMergrToDoc" Highlighted, and also have a message said: Compile error:
Expected Sub, Function or property. I spent one week already to try to solve this problem, but
got nothing. Somebody please please please help me.
Thanks in advance.
 
Hi Amy998,
I've never used this but I suspect by the examples shown in F1 help that you may have to change channels or terminate in between each?? Here's the help file:

Dynamic Data Exchange (DDE) Example
The following example establishes a DDE link with Microsoft Excel, places some values into cells in the first row of a new worksheet, and charts the values. First, the DDEInitiate function opens a channel to begin the DDE conversation. Then, the DDEExecute statement sends Microsoft Excel the command to open a new worksheet, and the DDERequest function asks Microsoft Excel for the name of the newly created worksheet. A new channel is opened, and the DDEPoke statement sends to Microsoft Excel the data to be charted. Finally, the DDETerminate statement terminates the DDE link with Microsoft Excel, and the DDETerminateAll statement terminates all active DDE links.

Sub ExcelDDE()
Dim intI As Integer, intChan1 As Integer
Dim strTopics As String, strResp As String, strSheetName As String

On Error Resume Next ' Set up error handling.

intChan1 = DDEInitiate("Excel", "System") ' Establish link.
If Err Then ' If error occurs, Excel may
Err = 0 ' not be running. Reset error
Shell "C:\Excel\Excel.exe", 1 ' and start spreadsheet.
If Err Then Exit Sub ' If another error, exit.
' Establish Spreadsheet link.
intChan1 = DDEInitiate("Excel", "System")
End If

' Create new worksheet.
DDEExecute intChan1, "[New(1)]"
' Get topic list, worksheet name.
strTopics = DDERequest(intChan1, "Selection")
strSheetName = Left(strTopics, InStr(1, strTopics, "!") - 1)
' Terminate DDE link.
DDETerminate intChan1
' Establish link with new worksheet.
intChan1 = DDEInitiate("Excel", strSheetName)
For intI = 1 To 10 ' Put some values into
DDEPoke intChan1, "R1C" & intI, intI ' first row.
Next intI
' Make chart.
DDEExecute intChan1, "[Select(""R1C1:R1C10"")][New(2,2)]"
' Terminate all links.
DDETerminateAll
End Sub

I'll give it a try meantime, hopefully someone with more experience with this will come along and straighten us out... :) Gord
ghubbell@total.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top