Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields,microsoft.public.word.vba.general
Alicia Alicia is offline
external usenet poster
 
Posts: 17
Default Automating Word 2007 mail merge?

Cross-posting from Word Programming into Word mailmerge and fax.

"Alicia" wrote:

I am running an SQR process that generates a configuration file (text saved
as .cfg) and a data input file (csv format) and then does a system call to
execute the Word 2007 mail merge process. The Word mail merge process, reads
the coinfguration file to determine where the input file resides, what Word
template to use and where to write the merged output file. This process is
executing on a remote server and has to be invisible to the user with no
manual intervention needed

Creating the file works but the mail merge stops (waiting for interaction)
when it gets to the "Finalize" stage. If I connect to the server it is
executing on and click Finalize, the process requests a "Save As" name. The
macros we currently have working in Word 2003, read the input configuration
file and automatically create the file based on the name setup in the .cfg
file. Is there a setting or something that we can set to make Word 2007
respond the same way as Word 2003.

Thanks,

  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields,microsoft.public.word.vba.general
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Automating Word 2007 mail merge?

Show us the code of the macro that works in 2003

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Alicia" wrote in message
...
Cross-posting from Word Programming into Word mailmerge and fax.

"Alicia" wrote:

I am running an SQR process that generates a configuration file (text
saved
as .cfg) and a data input file (csv format) and then does a system call
to
execute the Word 2007 mail merge process. The Word mail merge process,
reads
the coinfguration file to determine where the input file resides, what
Word
template to use and where to write the merged output file. This process
is
executing on a remote server and has to be invisible to the user with no
manual intervention needed

Creating the file works but the mail merge stops (waiting for
interaction)
when it gets to the "Finalize" stage. If I connect to the server it is
executing on and click Finalize, the process requests a "Save As" name.
The
macros we currently have working in Word 2003, read the input
configuration
file and automatically create the file based on the name setup in the
.cfg
file. Is there a setting or something that we can set to make Word 2007
respond the same way as Word 2003.

Thanks,



  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields,microsoft.public.word.vba.general
Alicia Alicia is offline
external usenet poster
 
Posts: 17
Default Automating Word 2007 mail merge?

Macro is run from the STDLTR.DOT. It is called from EMPTY.DOC using
PEN_RPT.doc as the output template. If you have somewhere I can send the 3
files, I'd be glad to send all of them to you. I can also send you a mocked
up (can't send real data from site) .cfg & data input files.

Thank you,

================================================== ====
' 11/19/02 - Alicia Lee (E0091159) - Modified to run via PIA on the
' Web - added code to read a configuration file for the report input and
output
' names and locations

'global variables
Dim letter_out As String 'Letter output name (PASOF01_PID)
Dim pen_rpt_ltrfile As Variant 'variable used to check if the
input file exists
Dim pen_rpt_filename As String 'fully qualified report name for
Letter Template
Dim pen_rpt_filesave As String 'fully qualified merged letter
document name
Dim pen_rpt_letter As String 'Name of the Letter Template
Dim pen_rpt_runlocation As String 'Location of WinWord mail merge
template
Dim pen_rpt_data As String 'Input data file name
Dim pen_rpt_outputlocation As String 'Directory location for the output
Sub Main()

'if there is an error during the processing, go to the Errmsg function
On Error GoTo Errmsg

'open the configuration file to get the report input/output information
Open "c:\ps\PEN_RPT.cfg" For Input As #2

' Read configuration data into variables
'letter name (pen_rpt_letter), Location of WinWord mail merge template
(pen_rpt_runlocation),
'input data location (pen_rpt_data), merged letter output location
(pen_rpt_outputlocation),
'and merged letter file name (letter_out)
Input #2, pen_rpt_letter, pen_rpt_runlocation, pen_rpt_data,
pen_rpt_outputlocation, letter_out

'change to the directory the input data is located
ChangeFileOpenDirectory "c:\ps"

'verify the input data file exists
pen_rpt_ltrfile = Dir(pen_rpt_data)

If pen_rpt_ltrfile = "" Then
'exit if there is no input data file
Application.Quit SaveChanges:=wdDoNotSaveChanges
Else
'build the fully qualified report name
pen_rpt_filename = pen_rpt_runlocation + "\" + pen_rpt_letter + ".DOC"
'open the input datafile
Documents.Open pen_rpt_filename, , ReadOnly, , , , , , , , , True
'make the letter document the active document
pen_rpt_filename = ActiveDocument.Name
'start the mail merge process
ActiveDocument.MailMerge.OpenDataSource pen_rpt_ltrfile, , , ReadOnly

With ActiveDocument.MailMerge
'send the merged data to a new document
.Destination = wdSendToNewDocument
.Execute
End With

'set the merged letter document name
pen_rpt_filesave = pen_rpt_outputlocation + "\" + letter_out + ".doc"

'save the merged letter
ActiveDocument.SaveAs pen_rpt_filesave
'close all open documents
Documents.Close wdDoNotSaveChanges

'close the configuration file
Close #2

'delete the input data file
'Kill pen_rpt_data

'delete the configuration file
'Kill "D:\temp\PEN_RPT.cfg"

'exit Word
Application.Quit SaveChanges:=wdDoNotSaveChanges

End If

Exit Sub

Errmsg:
WriteError Err.Number & "-" & Err.Description

End Sub

Sub WriteError(Errmsg As String)

'create the fully qualified error log file name
'pen_rpt_filename = pen_rpt_outputlocation + "\" + pen_rpt_letter +
"_error.log"
pen_rpt_filename = "c:\ps\" + pen_rpt_letter + "_error.log"

'open the error log file

'Open pen_rpt_filename For Append As #1
Open pen_rpt_filename For Append As #3

'write the error message(s)
Print #3, Date & " - " & Errmsg

'close the error message file
Close #3

End Sub



"Doug Robbins - Word MVP" wrote:

Show us the code of the macro that works in 2003

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Alicia" wrote in message
...
Cross-posting from Word Programming into Word mailmerge and fax.

"Alicia" wrote:

I am running an SQR process that generates a configuration file (text
saved
as .cfg) and a data input file (csv format) and then does a system call
to
execute the Word 2007 mail merge process. The Word mail merge process,
reads
the coinfguration file to determine where the input file resides, what
Word
template to use and where to write the merged output file. This process
is
executing on a remote server and has to be invisible to the user with no
manual intervention needed

Creating the file works but the mail merge stops (waiting for
interaction)
when it gets to the "Finalize" stage. If I connect to the server it is
executing on and click Finalize, the process requests a "Save As" name.
The
macros we currently have working in Word 2003, read the input
configuration
file and automatically create the file based on the name setup in the
.cfg
file. Is there a setting or something that we can set to make Word 2007
respond the same way as Word 2003.

Thanks,




  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields,microsoft.public.word.vba.general
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Automating Word 2007 mail merge?

Hi Alicia,

Please send to files to me at



Remove the ( ) from around the @
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Alicia" wrote in message
...
Macro is run from the STDLTR.DOT. It is called from EMPTY.DOC using
PEN_RPT.doc as the output template. If you have somewhere I can send the
3
files, I'd be glad to send all of them to you. I can also send you a
mocked
up (can't send real data from site) .cfg & data input files.

Thank you,

================================================== ====
' 11/19/02 - Alicia Lee (E0091159) - Modified to run via PIA on the
' Web - added code to read a configuration file for the report input and
output
' names and locations

'global variables
Dim letter_out As String 'Letter output name (PASOF01_PID)
Dim pen_rpt_ltrfile As Variant 'variable used to check if the
input file exists
Dim pen_rpt_filename As String 'fully qualified report name for
Letter Template
Dim pen_rpt_filesave As String 'fully qualified merged letter
document name
Dim pen_rpt_letter As String 'Name of the Letter Template
Dim pen_rpt_runlocation As String 'Location of WinWord mail merge
template
Dim pen_rpt_data As String 'Input data file name
Dim pen_rpt_outputlocation As String 'Directory location for the
output
Sub Main()

'if there is an error during the processing, go to the Errmsg function
On Error GoTo Errmsg

'open the configuration file to get the report input/output information
Open "c:\ps\PEN_RPT.cfg" For Input As #2

' Read configuration data into variables
'letter name (pen_rpt_letter), Location of WinWord mail merge template
(pen_rpt_runlocation),
'input data location (pen_rpt_data), merged letter output location
(pen_rpt_outputlocation),
'and merged letter file name (letter_out)
Input #2, pen_rpt_letter, pen_rpt_runlocation, pen_rpt_data,
pen_rpt_outputlocation, letter_out

'change to the directory the input data is located
ChangeFileOpenDirectory "c:\ps"

'verify the input data file exists
pen_rpt_ltrfile = Dir(pen_rpt_data)

If pen_rpt_ltrfile = "" Then
'exit if there is no input data file
Application.Quit SaveChanges:=wdDoNotSaveChanges
Else
'build the fully qualified report name
pen_rpt_filename = pen_rpt_runlocation + "\" + pen_rpt_letter +
".DOC"
'open the input datafile
Documents.Open pen_rpt_filename, , ReadOnly, , , , , , , , , True
'make the letter document the active document
pen_rpt_filename = ActiveDocument.Name
'start the mail merge process
ActiveDocument.MailMerge.OpenDataSource pen_rpt_ltrfile, , ,
ReadOnly

With ActiveDocument.MailMerge
'send the merged data to a new document
.Destination = wdSendToNewDocument
.Execute
End With

'set the merged letter document name
pen_rpt_filesave = pen_rpt_outputlocation + "\" + letter_out +
".doc"

'save the merged letter
ActiveDocument.SaveAs pen_rpt_filesave
'close all open documents
Documents.Close wdDoNotSaveChanges

'close the configuration file
Close #2

'delete the input data file
'Kill pen_rpt_data

'delete the configuration file
'Kill "D:\temp\PEN_RPT.cfg"

'exit Word
Application.Quit SaveChanges:=wdDoNotSaveChanges

End If

Exit Sub

Errmsg:
WriteError Err.Number & "-" & Err.Description

End Sub

Sub WriteError(Errmsg As String)

'create the fully qualified error log file name
'pen_rpt_filename = pen_rpt_outputlocation + "\" + pen_rpt_letter +
"_error.log"
pen_rpt_filename = "c:\ps\" + pen_rpt_letter + "_error.log"

'open the error log file

'Open pen_rpt_filename For Append As #1
Open pen_rpt_filename For Append As #3

'write the error message(s)
Print #3, Date & " - " & Errmsg

'close the error message file
Close #3

End Sub



"Doug Robbins - Word MVP" wrote:

Show us the code of the macro that works in 2003

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Alicia" wrote in message
...
Cross-posting from Word Programming into Word mailmerge and fax.

"Alicia" wrote:

I am running an SQR process that generates a configuration file (text
saved
as .cfg) and a data input file (csv format) and then does a system
call
to
execute the Word 2007 mail merge process. The Word mail merge
process,
reads
the coinfguration file to determine where the input file resides, what
Word
template to use and where to write the merged output file. This
process
is
executing on a remote server and has to be invisible to the user with
no
manual intervention needed

Creating the file works but the mail merge stops (waiting for
interaction)
when it gets to the "Finalize" stage. If I connect to the server it
is
executing on and click Finalize, the process requests a "Save As"
name.
The
macros we currently have working in Word 2003, read the input
configuration
file and automatically create the file based on the name setup in the
.cfg
file. Is there a setting or something that we can set to make Word
2007
respond the same way as Word 2003.

Thanks,






  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields,microsoft.public.word.vba.general
Alicia Alicia is offline
external usenet poster
 
Posts: 17
Default Automating Word 2007 mail merge?

I sent the files to you earlier this morning.

Alicia

"Doug Robbins - Word MVP" wrote:

Hi Alicia,

Please send to files to me at



Remove the ( ) from around the @
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Alicia" wrote in message
...
Macro is run from the STDLTR.DOT. It is called from EMPTY.DOC using
PEN_RPT.doc as the output template. If you have somewhere I can send the
3
files, I'd be glad to send all of them to you. I can also send you a
mocked
up (can't send real data from site) .cfg & data input files.

Thank you,

================================================== ====
' 11/19/02 - Alicia Lee (E0091159) - Modified to run via PIA on the
' Web - added code to read a configuration file for the report input and
output
' names and locations

'global variables
Dim letter_out As String 'Letter output name (PASOF01_PID)
Dim pen_rpt_ltrfile As Variant 'variable used to check if the
input file exists
Dim pen_rpt_filename As String 'fully qualified report name for
Letter Template
Dim pen_rpt_filesave As String 'fully qualified merged letter
document name
Dim pen_rpt_letter As String 'Name of the Letter Template
Dim pen_rpt_runlocation As String 'Location of WinWord mail merge
template
Dim pen_rpt_data As String 'Input data file name
Dim pen_rpt_outputlocation As String 'Directory location for the
output
Sub Main()

'if there is an error during the processing, go to the Errmsg function
On Error GoTo Errmsg

'open the configuration file to get the report input/output information
Open "c:\ps\PEN_RPT.cfg" For Input As #2

' Read configuration data into variables
'letter name (pen_rpt_letter), Location of WinWord mail merge template
(pen_rpt_runlocation),
'input data location (pen_rpt_data), merged letter output location
(pen_rpt_outputlocation),
'and merged letter file name (letter_out)
Input #2, pen_rpt_letter, pen_rpt_runlocation, pen_rpt_data,
pen_rpt_outputlocation, letter_out

'change to the directory the input data is located
ChangeFileOpenDirectory "c:\ps"

'verify the input data file exists
pen_rpt_ltrfile = Dir(pen_rpt_data)

If pen_rpt_ltrfile = "" Then
'exit if there is no input data file
Application.Quit SaveChanges:=wdDoNotSaveChanges
Else
'build the fully qualified report name
pen_rpt_filename = pen_rpt_runlocation + "\" + pen_rpt_letter +
".DOC"
'open the input datafile
Documents.Open pen_rpt_filename, , ReadOnly, , , , , , , , , True
'make the letter document the active document
pen_rpt_filename = ActiveDocument.Name
'start the mail merge process
ActiveDocument.MailMerge.OpenDataSource pen_rpt_ltrfile, , ,
ReadOnly

With ActiveDocument.MailMerge
'send the merged data to a new document
.Destination = wdSendToNewDocument
.Execute
End With

'set the merged letter document name
pen_rpt_filesave = pen_rpt_outputlocation + "\" + letter_out +
".doc"

'save the merged letter
ActiveDocument.SaveAs pen_rpt_filesave
'close all open documents
Documents.Close wdDoNotSaveChanges

'close the configuration file
Close #2

'delete the input data file
'Kill pen_rpt_data

'delete the configuration file
'Kill "D:\temp\PEN_RPT.cfg"

'exit Word
Application.Quit SaveChanges:=wdDoNotSaveChanges

End If

Exit Sub

Errmsg:
WriteError Err.Number & "-" & Err.Description

End Sub

Sub WriteError(Errmsg As String)

'create the fully qualified error log file name
'pen_rpt_filename = pen_rpt_outputlocation + "\" + pen_rpt_letter +
"_error.log"
pen_rpt_filename = "c:\ps\" + pen_rpt_letter + "_error.log"

'open the error log file

'Open pen_rpt_filename For Append As #1
Open pen_rpt_filename For Append As #3

'write the error message(s)
Print #3, Date & " - " & Errmsg

'close the error message file
Close #3

End Sub



"Doug Robbins - Word MVP" wrote:

Show us the code of the macro that works in 2003

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Alicia" wrote in message
...
Cross-posting from Word Programming into Word mailmerge and fax.

"Alicia" wrote:

I am running an SQR process that generates a configuration file (text
saved
as .cfg) and a data input file (csv format) and then does a system
call
to
execute the Word 2007 mail merge process. The Word mail merge
process,
reads
the coinfguration file to determine where the input file resides, what
Word
template to use and where to write the merged output file. This
process
is
executing on a remote server and has to be invisible to the user with
no
manual intervention needed

Creating the file works but the mail merge stops (waiting for
interaction)
when it gets to the "Finalize" stage. If I connect to the server it
is
executing on and click Finalize, the process requests a "Save As"
name.
The
macros we currently have working in Word 2003, read the input
configuration
file and automatically create the file based on the name setup in the
.cfg
file. Is there a setting or something that we can set to make Word
2007
respond the same way as Word 2003.

Thanks,






Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail Merge Error--Word 2007/Outlook 2007 lilkel31 Mailmerge 4 October 31st 07 02:01 PM
Automating mail merge Patrick Mailmerge 3 June 8th 07 07:02 AM
Automating mail merge Patrick Mailmerge 0 June 5th 07 11:24 PM
Automating Mail merge between Word 2003 and Access 2003 using VB.NET [email protected] Mailmerge 5 October 17th 06 11:25 PM
Problem with automating mail merge HeatherO Mailmerge 2 March 29th 05 10:11 PM


All times are GMT +1. The time now is 02:33 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"