LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default DDE Argument exchange with Word

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
exchange cell content JIMPAP Excel Discussion (Misc queries) 1 May 24th 09 09:46 AM
Exchange folders Scott Flanders New Users to Excel 0 September 22nd 08 02:17 PM
Gift Exchange Help! Marina B Excel Worksheet Functions 1 December 6th 07 10:22 PM
Foreign Exchange peterthistle Excel Discussion (Misc queries) 2 November 21st 05 02:19 PM
how to copy the function argument box onto word Hannibal Excel Discussion (Misc queries) 1 April 13th 05 09:24 PM


All times are GMT +1. The time now is 02:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"