[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


ShellExecute -- Printing Error -- Memory Problem ?

Posted on 2006-04-07
Medium Priority
Last Modified: 2010-04-07
We are having a problem printing a certain document from Excel when it is shelled from VB6 (most documents print fine). If we run Excel and load the file separately, it prints fine (using Black Ice ColorPlus printer driver). However, launching Excel via ShellExecute causes an error. We aren't sure what is causing it, but the only thing that seems different is that it is run in a shell. It normally works fine, but could this be causing problems?

Function StartDoc(DocName As String) As Long
   Dim Scr_hDC As Long
   Scr_hDC = GetDesktopWindow()
   StartDoc = ShellExecute(Scr_hDC, "Open", DocName, "", "C:\", SW_SHOWNORMAL)

p.s., first part of error message:

Your file could not be printed due to an error on Black Ice ColorPlus on IcePortAD:. There are several possible reasons:
Question by:GivenRandy
LVL 28

Accepted Solution

vinnyd79 earned 2000 total points
ID: 16400575
Do you get the error if you call it like this?

Function StartDoc(DocName As String) As Long
   Dim Scr_hDC As Long
   Scr_hDC = GetDesktopWindow()
   StartDoc = ShellExecute(0, "Open", DocName, "", "", SW_SHOWNORMAL)

Author Comment

ID: 16402645
Turns out that their latest driver fixes up. Time for an upgrade!

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
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…
Suggested Courses
Course of the Month19 days, 23 hours left to enroll

873 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