Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Does anyone know how to send a variable text string from
Excel to Word using a DDE argument in an Excel macro? The following Excel macro will send a specific text string, but I want to use a variable to define the text string. Sub WordOpen(customerName) ' ' Dim WordApp As Object Dim WordDoc As Word.Document Dim Chan As Variant Dim PathName, FileName As String PathName = ActiveWorkbook.Path FileName = PathName & "\Test.doc" Set WordApp = CreateObject("Word.Application") Set WordDoc = WordApp.Documents.Open(FileName) WordApp.Visible = True ' Initiate a channel with Microsoft Word. Chan = DDEInitiate("WinWord", FileName) ' This sends the text to Word DDEExecute Chan, "[Module1.Begin(""John Doe"")]" ' Want a command to send variable text customerName to Word, similar to this except it does not work ' DDEExecute Chan, "[Module1.Begin(customerName)]" ' Terminate the channel. DDETerminate Chan ' End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
exchange cell content | Excel Discussion (Misc queries) | |||
Exchange folders | New Users to Excel | |||
Gift Exchange Help! | Excel Worksheet Functions | |||
Foreign Exchange | Excel Discussion (Misc queries) | |||
how to copy the function argument box onto word | Excel Discussion (Misc queries) |