Solved

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

Posted on 2004-10-12
4
153 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
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…

791 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