Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Powerbuilder and MS Word (Mailmerge)

Status
Not open for further replies.

vadnagra

Technical User
Oct 10, 2004
23
US
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 )
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top