[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Printing format Problems

Posted on 2004-10-11
1
Medium Priority
?
206 Views
Last Modified: 2010-05-02
Hi:
    When I use Debug.Print with the following code; the output is correctly formatted but when I use Printer.Print I lose the formatting(does not align at the decimal point). Can someone tell me why this happens and how to fix it?

 Private Sub cmdPrint_Click()
Dim strPS As String * 7, strPS2 As String * 7, strPS3 As String * 7
 
 
 RSet strPS = Format(564, "##,###.")
 RSet strPS2 = Format(777, "##,###.")
 RSet strPS3 = Format(902, "##,###.")
 Printer.Print strPS, strPS2, strPS3
 'Debug.Print strPS, strPS2, strPS3
 
 RSet strPS = Format(4500, "##,###.")
 RSet strPS2 = Format(888, "##,###.")
 RSet strPS3 = Format(9, "##,###.")
 Printer.Print strPS, strPS2, strPS3
 'Debug.Print strPS, strPS2, strPS3
 
 RSet strPS = Format(4, "##,###.")
 RSet strPS2 = Format(59, "##,###.")
 RSet strPS3 = Format(34556, "##,###.")
 Printer.Print strPS, strPS2, strPS3
 'Debug.Print strPS, strPS2, strPS3
 Printer.EndDoc
 
End Sub

0
Comment
Question by:LearningJava
[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
1 Comment
 
LVL 3

Accepted Solution

by:
Noel_Castillo earned 1200 total points
ID: 12283295
The immediate window actually does the allignment for you during debug.print and not your code. Theres nothing wrong with your code. Its your printers font that disalligns your figures. most fonts perform kerning-compressing the letters to obtain smallest width possible. ex comma has smaller width comapare to figure # 9. But there are still some other fonts that has a uniform width for all its character set. like 'Courier New' & 'Fixedsys'
Try to add this code on top before printing and I hope this helps. :)

 For i = 0 To Printer.FontCount - 1
    If Printer.Fonts(i) = "Courier New" Then
        Printer.Font = Printer.Fonts(i)
        Exit For
    End If
 Next

...
...
do your printer.print here
...
...


0

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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

649 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