OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-01-2003, 09:33
claudius
Guest
 
Posts: n/a
Default Batch/Automated Printing

I need to print a batch of .cdr files can i automate this process using VBA?
Thanks
Reply With Quote
  #2  
Old 14-01-2003, 08:17
batman|
Guest
 
Posts: n/a
Default


exsactly, what are you whand to do
"by the fingers"
Reply With Quote
  #3  
Old 14-01-2003, 16:22
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default Re: Batch/Automated Printing

Quote:
Originally Posted by claudius
I need to print a batch of .cdr files can i automate this process using VBA?
Yes, you can. Here is how you do it:

Code:
Sub PrintFiles()
    Dim f As String
    Dim Path As String
    Dim FileName As String
    Dim doc As Document
    
    Path = "C:\Temp\"
    f = Dir(Path & "*.cdr")
    While f <> ""
        FileName = Path & f
        Set doc = OpenDocument(FileName)
        ' Change your print options here like this:
        ' doc.PrintSettings.Copies = 1
        doc.PrintOut
        doc.Close
        f = Dir()
    Wend
End Sub
Reply With Quote
  #4  
Old 20-01-2003, 11:27
claudius
Guest
 
Posts: n/a
Default Re: Batch/Automated Printing

Great stuff - the script works very well. Is it possible to specify printer settings such as paper size or chose a network printer using VBA ?
Thanks.
Reply With Quote
  #5  
Old 20-01-2003, 17:56
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default Re: Batch/Automated Printing

Quote:
Originally Posted by claudius
Great stuff - the script works very well. Is it possible to specify printer settings such as paper size or chose a network printer using VBA ?
Well, you can specify most of the settings which you can through File>Print dialog. You need to use Document.PrintSettings object. Unfortunately you cannot specify printer driver-specific settings like paper size and orientation, etc.

You can, however, select a different printer through VBA.

You need to go through the Application.Printers collection and find the printer that matches the name of the printer you want to print to. Then once you get the proper printer object, set it to Document.PrintSettings.Printer property:

Code:
Sub PrintFiles()
    ' ....
    Dim n As Long
    Dim prn As CorelDRAW.Printer
    ' ....

    Set prn = Nothing
    ' Find the printer
    For n = 1 To Printers.Count
        If Printers(n).Name = "Linotronic 930 v52.3" Then
            Set prn = Printers(n)
            Exit For ' Found it
        End If
    Next n
    
    If prn Is Nothing Then
        MsgBox "Unable to find the printer"
        Exit Sub
    End If

    ' .... Loop through the files as in the previous example
        Set doc.PrintSettings.Printer = prn
        doc.PrintOut
    ' ... Finish the loop
End Sub
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Automate printing hernux CorelDRAW/Corel DESIGNER VBA 0 31-03-2005 22:39
Draw 12 : Printing Problem Hernán General 3 20-09-2004 11:54
Speed up printing RonHill General 0 22-06-2004 14:20
Printing multiple copies sfldan CorelDRAW CS 0 21-08-2003 15:37
Printing Mark CorelDRAW/Corel DESIGNER VBA 7 11-07-2003 18:02


All times are GMT -5. The time now is 09:06.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com