![]() |
Passing Parameters to Word from Excel
I need to pass some parameters to Word 2003 from Excel 2003. Specifically, I to want pass the path of a currently opened Excel fil to a Word macro. Here is my current code: Set WordApp = CreateObject(\"Word.Application\") 'Create ne WordApp object WordApp.Documents.Open (InspShtDOCLoc) 'Open the specific wordDoc WordApp.Visible = True 'Set the wordDOC as visible chanNum = DDEInitiate( _ app:=\"WinWord\", _ topic:=InspShtDOCLoc) test = ThisWorkbook.FullName 'Path of this Excel file WordApp.DDEExecute chanNum \"[GeneralMacros.OpenDataSourceInspect(test)]\" WordApp.DDETerminate chanNum I get the filename of the opened Excel file, pass it to a Word Macro which then sets up a Mail Merge with the Excel file path just passed t it. I get the error "Invalid Channel Number" Any changes (or even a completly different approach) would be very muc appreciated -- jake172 ----------------------------------------------------------------------- jake1729's Profile: http://www.excelforum.com/member.php...fo&userid=2726 View this thread: http://www.excelforum.com/showthread.php?threadid=47126 |
All times are GMT +1. The time now is 05:44 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com