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 12-12-2003, 10:21
Jon Lorber
Guest
 
Posts: n/a
Default VBA Select Printer?

I read a few posts but I haven't been able to select a printer in CD11 in VB.

I tried this but get Object Required as the error:
Code:
Set ActiveDocument.PrintSettings.Printer = "MyPrinter"
I was able to however select a print style which has a printer associated with it with this code but I think this is just a way around my problem:

Code:
Application.ActiveDocument.PrintSettings.Load "C:\Documents and Settings\MySelf\Application Data\Corel\Graphics11\User Custom Data\Print Styles\MyPrintStyle.prs"
Reply With Quote
  #2  
Old 12-12-2003, 10:36
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default Re: VBA Select Printer?

In CorelDRAW 11 you need to actually find a printer with the given name and then set to to the Printer property of PrintSettings.

Code:
Sub SetPrinter()
    Dim prn As Printer
    Dim n As Long
    
    Set prn = Nothing
    For n = 1 To Printers.Count
        If Printers(n).Name = "MyPrinter" Then
            Set prn = Printers(n)
            Exit For
        End If
    Next n
    
    If prn Is Nothing Then
        MsgBox "Printer not found", vbCritical
    Else
        Set ActiveDocument.PrintSettings.Printer = prn
        ' Do the printing here
    End If
End Sub
In CorelDRAW 12, however, there will be a method PrintSettings.SelectPrinter which will allow to do all the above in one shot:

Code:
ActiveDocument.PrintSettings.SelectPrinter "MyPrinter"
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
Select different printers in VBA Anonymous General 2 02-02-2005 18:14
VBA help needed - changing colours fremoikaner CorelDRAW/Corel DESIGNER VBA 1 18-11-2004 07:06
Local Printer Selection ddonnahoe CorelDRAW/Corel DESIGNER VBA 2 13-01-2004 08:36
Printer page size and orientation from VBA narcix CorelDRAW/Corel DESIGNER VBA 9 17-10-2003 15:54
Detect if VBA is installed (an answer and a question) reanan CorelDRAW/Corel DESIGNER VBA 3 04-12-2002 15:35


All times are GMT -5. The time now is 22:13.


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