How to use different fonts while printing one line ?

Posted on 2002-05-16
Last Modified: 2013-12-03
I have one line of text, concatenated from smaller pieces. On the print out I have to see these pieces printed with the different fonts. If an array, need ideas on how to make Printer.Print strLine(i) stay on the same line without going into vbCrLf at the end of the line.
Question by:laguna21
  • 2
  • 2
  • 2

Expert Comment

ID: 7014653
Printer.Print "Line1 ";
Printer.Print "Line2"

This should do it

Expert Comment

ID: 7014662
More info...

Put a semi-colon after the line.

Your code..

Printer.Print strLine(i);

Author Comment

ID: 7014745
It doesn't print at all. Any other ideas? I need it to be like this:
                 Header Goes Here(already printing)
SUN                   MON           TUE        WED ...
29                    30             31         1
12345                |              |123456   |345678 |...
23456(FontStrikethru)|789076 (normal font)

                 Footer goes here
Everything is printing fine, except different fonts on the same line.

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

LVL 22

Expert Comment

ID: 7014915
To switch fonts, simply change them on the printer.  For same line, end the Print line with the semicolon (;), for new line omit it, for "tabbing" use a comma (,).


dim strDayOfWeekArray() as string

strDayOfWeekArray = split("Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday",",")

Printer.Font.Name = "Times New Roman"
Pritner.Font.Size = 12
For i=0 to 6
  Printer.Print strDayOfWeekArray(i),
next i
printer.print ' go to next line = "Courier New"
printer.print string$(50,"-") = "Arial"
printer.print "29","30","1","2","3","4","5" = "Courier New"
printer.print string$(50,"-")

LVL 22

Accepted Solution

rspahitz earned 200 total points
ID: 7014926
(Actually, the commas will work better if they are applied to the same font name and size, so you probably want to change "Arial" back to "Times New Roman".)


Author Comment

ID: 7016330
Thank you. It finally worked for me. But this idea was offered first by gencross, so I want to share points between you two.

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Paint/Redraw window while dragging 16 76
MS Access Search and Replace Using VBA 6 70
Recommendation vb6 to or others 14 142
Formula problem with Excel attachment 6 26
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…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

786 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