Solved

VB6: Need to print photoshop files in a batch using the default printer.

Posted on 2004-10-12
4
149 Views
Last Modified: 2011-08-18
I need to print a bunch of photoshop files I generated using the photoshop APIs.  All that is done, i just don't know how to do the printing and since it will be large batches it would be a sweet feature to automate.

What code can I use to do such a thing?  Photoshop is the default handler for the .psd files.  I am okay with using the defualt printer if that greatly simplifies things.  Any help?
0
Comment
Question by:Brothernod
  • 2
4 Comments
 
LVL 1

Author Comment

by:Brothernod
ID: 12294853
Is it really different from printing any other file type with the default application?
0
 
LVL 1

Author Comment

by:Brothernod
ID: 12319814
Well I raised the point value in an attempt of getting interest in my topic.  I've seen printing questions answered when i did a search so I don't understand why i'm not getting any attention for my small nuance.
0
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
ID: 12354367
Hi, Brothernod.

I don't have access to Photoshop so I've no way to test the code below.  The code sample here uses the ShellExecute API function to print the document name passed.  This approach works fine with Word and various other file types, it invokes the default application based on the file extension, but it apparently doesn't work for all file types.  I don't know about Photoshop files.  You'll need to edit the code and change PathToPSDFile to the fully qualified path and name of a PSD file to test against.

Here are links to more information on the ShellExecute command in case you're interested.
1.  http://www.vb-helper.com/howto_shellexecute.html
2.  http://support.microsoft.com/kb/q170918/
3.  http://www.wincron.com/trflpcshellexecute.html

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
                   (ByVal hwnd As Long, ByVal lpszOp As String, _
                    ByVal lpszFile As String, ByVal lpszParams As String, _
                    ByVal LpszDir As String, ByVal FsShowCmd As Long) _
                    As Long

Private Sub Command1_Click()
    Dim lngResult As Long
    lngResult = ShellExecute(Me.hwnd, "print", "PathToPSDFile", "", "", SW_HIDE)
End Sub
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

911 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

17 Experts available now in Live!

Get 1:1 Help Now