Window printer dialog box

Posted on 2004-11-04
Last Modified: 2010-05-02

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?

Question by:sata
    1 Comment
    LVL 76

    Accepted Solution

    This is pre-Xp behaviour.

    This article recommends that you send to a file, and print that.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
    If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    26 Experts available now in Live!

    Get 1:1 Help Now