Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Unexpected printer color shift

Posted on 1999-07-29
Medium Priority
Last Modified: 2010-04-30
My app produces a rather complicated printout involving both graphics and text. The intention is to print in black only.  I have the following two statements in my Form_Load()

Printer.ColorMode = vbPRCMMonochrome
Printer.FillColor = &H808080

When using a color printer, there is one place in the code where the printed color shifts from black to light blue for all following calls to Printer.Line

I don't know why this happens, and would appreciate any suggestions.  Here is the code fragment where it happens:

Dim A As String*1 ' A=" ", or A="-", or A= something else

For I = 1 to ILIMIT
   --- compute various X,Y coordinates
   If A = " " Then
      Printer.FillStyle = 0
      Printer.Line (XA, YA)-(XB, YB),,B
   ElseIf A = "-" Then
      Printer.FillStyle = 1
      Printer.Line (BXA,BYA)-(BXB,BYA) ' ** this statement
                               triggers the color shift!
      Printer.Line (XA, YA)-(XB, YB),,B ' ** now this prints
                               in light blue, and also all
                            other Printer.Line statements
                            as we go round the loop.
      Printer.FillStyle = 1
      Printer.Line (XA, YA)-(XB, YB),,B
   End If
Next I

Question by:posnorm
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

ackid32 earned 300 total points
ID: 1528329
Use again the color init statement before the printer.line,
i hope it works.

Author Comment

ID: 1528330
Thank you! - Sometimes the VB printer object doesn't allow changing a property in mid-page.  Annoying.

Another solution to my problem is to specifically include vbBlack (if that's what is wanted) as:

printer.line (x1,y1)-(x2,y2), vbBlack, B

I still don't know why the color shift occurred, but as long as your suggestion (or mine) works, I'll worry about it some other time. I'd still like to know. -- Norm

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

660 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