Solved

How to use different fonts while printing one line ?

Posted on 2002-05-16
6
143 Views
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.
0
Comment
Question by:laguna21
[X]
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
  • 2
  • 2
  • 2
6 Comments
 
LVL 4

Expert Comment

by:gencross
ID: 7014653
Printer.Print "Line1 ";
Printer.Print "Line2"
Printer.EndDoc

This should do it
0
 
LVL 4

Expert Comment

by:gencross
ID: 7014662
More info...

Put a semi-colon after the line.

Your code..

Printer.Print strLine(i);
0
 

Author Comment

by:laguna21
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.


 
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 22

Expert Comment

by:rspahitz
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 (,).

Example:

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

printer.font.name = "Courier New"
printer.print string$(50,"-")

printer.font.name = "Arial"
printer.print "29","30","1","2","3","4","5"

printer.font.name = "Courier New"
printer.print string$(50,"-")

'etc.
printer.enddoc
0
 
LVL 22

Accepted Solution

by:
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".)

0
 

Author Comment

by:laguna21
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.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

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 need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

732 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