trying to DDE from Excel to Word using DDEInitiate

P

Pierre Laporte

I am trying to establish a DDE link between my Excel process and a Word
process.

Even thought I have openned Word I can't seem to be able to create a
channel. Here is my code in VB.

I am using Office 2000 on WindowsXp Pro.

I did executed the following Macro and Winword|System is listed among
available processes but channelNumber in AppelFrame is always 0.

Sub Initiate_DDE()
Dim ChanNum As Long

ChanNum = Application.DDEInitiate("", "")

End Sub

Any help appreciated.
________________________________________________________________________________

Public Function AppelFrame() As Boolean

Dim channelNumber As Long, returnList As Variant, i As Integer
Dim err_no As Integer

On Error GoTo Err_AppelFrame

AppelFrame = False
channelNumber = Application.DDEInitiate( _
app:="Winword", topic:="System")
If channelNumber Then
returnList = Application.DDERequest(channelNumber, "Topics")
For i = LBound(returnList) To UBound(returnList)
Worksheets("Sheet1").Cells(i, 1).Formula = returnList(i)
Next i
Application.DDETerminate channelNumber

AppelFrame = True
Else
err_no = DDEAppReturnCode()
End If

Exit_AppelFrame:
Exit Function

Err_AppelFrame:
MsgBox Err.Description
AppelFrame = False
Resume Exit_AppelFrame:
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top