I am using dde to connect between pb and Word to call a word template. I have a macro in my template which is called by the dde connection. The macro calls the functionality to mail merge data between a SQL server database and the word template and save the resulting merged document. This works fine though I have to hard code the merged document name within the macro. I am trying to figure out how to pass the resulting documents name to the macro so that I can customize the name of the document.
Any help will be appreciated. I am using Word 2000 on XP with PB 8.
The code is as follows.
//If GetModuleHandle( lExeFile ) < 1 Then
// Run( lExeFile + " " + lDocFile )
// lChannelNumber = OpenChannel( "winword", lDocFile )
//Else
lChannelNumber = OpenChannel( "winword", "System" )
Integer rtn
RTN = ExecRemote('[FileOpen.Name=~"c:\lpoa.doc~"]', lChannelNumber)
lChannelNumber = OpenChannel( "winword", "c:\lpoa.doc" )
// MessageBox("IChannel for Open", lchannelnumber)
//End If
//ExecRemote( '[ToolsMacro.name=~"Macro1~",.run]', lChannelNumber )
ExecRemote('[Run("SaveDoc")]', lChannelNumber )
//ExecRemote( '[ToolsMacro.name=~"Macro1~",.run]', lChannelNumber )
CloseChannel( lChannelNumber )
//ExecRemote( '[FileExit,.no]', lChannelNumber )
Any help will be appreciated. I am using Word 2000 on XP with PB 8.
The code is as follows.
//If GetModuleHandle( lExeFile ) < 1 Then
// Run( lExeFile + " " + lDocFile )
// lChannelNumber = OpenChannel( "winword", lDocFile )
//Else
lChannelNumber = OpenChannel( "winword", "System" )
Integer rtn
RTN = ExecRemote('[FileOpen.Name=~"c:\lpoa.doc~"]', lChannelNumber)
lChannelNumber = OpenChannel( "winword", "c:\lpoa.doc" )
// MessageBox("IChannel for Open", lchannelnumber)
//End If
//ExecRemote( '[ToolsMacro.name=~"Macro1~",.run]', lChannelNumber )
ExecRemote('[Run("SaveDoc")]', lChannelNumber )
//ExecRemote( '[ToolsMacro.name=~"Macro1~",.run]', lChannelNumber )
CloseChannel( lChannelNumber )
//ExecRemote( '[FileExit,.no]', lChannelNumber )