sata
asked on
Window printer dialog box
Hi,
I have created a program to open a mailmerge template, and will use VB to control the merging of document.
I have initially work with this using WinXP, but realize that it wouldn't work for those in Win2000 environment. Therefore I have recompiled the project in a Win2k environment, reference object change from Microsoft Word 10.0 Object library to Microsoft Word 9.0 object library.
The compilation is fine, but I meet with a little problem. In my code I have this line:
With objDoc.MailMerge
If .State = wdMainAndDataSource Then
.Destination = wdSendToPrinter
.SuppressBlankLines = True
'get the record count of the datasource
With .DataSource
.ActiveRecord = wdLastRecord
x = .ActiveRecord
'set the activerecord back to the first
.ActiveRecord = wdFirstRecord
End With
Dim s As String
'loop the datasource count and merge one record at a time
For i = 1 To x
.DataSource.FirstRecord = i
.DataSource.LastRecord = i
.DataSource.ActiveRecord = i
.Execute False
Next i
End With
In WinXP environment, the job gets printed into the default printer directly, however in Win2K, the print dialog box get displayed.
Does anyone know if this is the behaviour of Word2000? And how can I overcome this?
Thanks!
I have created a program to open a mailmerge template, and will use VB to control the merging of document.
I have initially work with this using WinXP, but realize that it wouldn't work for those in Win2000 environment. Therefore I have recompiled the project in a Win2k environment, reference object change from Microsoft Word 10.0 Object library to Microsoft Word 9.0 object library.
The compilation is fine, but I meet with a little problem. In my code I have this line:
With objDoc.MailMerge
If .State = wdMainAndDataSource Then
.Destination = wdSendToPrinter
.SuppressBlankLines = True
'get the record count of the datasource
With .DataSource
.ActiveRecord = wdLastRecord
x = .ActiveRecord
'set the activerecord back to the first
.ActiveRecord = wdFirstRecord
End With
Dim s As String
'loop the datasource count and merge one record at a time
For i = 1 To x
.DataSource.FirstRecord = i
.DataSource.LastRecord = i
.DataSource.ActiveRecord = i
.Execute False
Next i
End With
In WinXP environment, the job gets printed into the default printer directly, however in Win2K, the print dialog box get displayed.
Does anyone know if this is the behaviour of Word2000? And how can I overcome this?
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.