Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 02-29-2020, 09:50 AM
Jennifer Murphy's Avatar
Jennifer Murphy Jennifer Murphy is offline Is there any way to get MsgBox columns to line up? Windows XP Is there any way to get MsgBox columns to line up? Office 2007
Competent Performer
Is there any way to get MsgBox columns to line up?
 
Join Date: Aug 2011
Location: Silicon Valley
Posts: 234
Jennifer Murphy is on a distinguished road
Default Is there any way to get MsgBox columns to line up?

Apparently, MsgBox uses a proportionally spaced font, so padding data with spaces does not result in aligned columns as this code illustrates:

Code:
Const t1 As String = "abcdef"
Const t2 As String = "ABCDEF"
Const t3 As String = "xx yy zz"
Const d1 As Double = 0.4567
Const d2 As Double = 12.3456
Const d3 As Double = 333.4444
Dim msg As String
msg = Left("  Text      ", 10) & Left(" Value   ", 8) & vbCr _
    & Left(t1 & "        ", 10) & Right("   " & Format(d1, "##0.00"), 8) & vbCr _
    & Left(t2 & "        ", 10) & Right("   " & Format(d2, "##0.00"), 8) & vbCr _
    & Left(t3 & "        ", 10) & Right("   " & Format(d3, "##0.00"), 8)
MsgBox msg
msg = Left("  Text      ", 10) & Left(" Value   ", 8) & vbCr _
    & Left(t1 & "        ", 10) & Right("   " & Format(d1, "000.00"), 8) & vbCr _
    & Left(t2 & "        ", 10) & Right("   " & Format(d2, "000.00"), 8) & vbCr _
    & Left(t3 & "        ", 10) & Right("   " & Format(d3, "000.00"), 8)
MsgBox msg
Is there any way to make this work with MsgBox?



If not, is there another relatively simple way to get aligned columns displayed to the Word document?
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Match to columns and then copy line to second list. Borut2019 Excel 0 02-18-2019 01:04 AM
Is there any way to get MsgBox columns to line up? Problem with Msgbox in VBA Puzzled Programmer Excel Programming 6 09-06-2018 04:34 PM
Is there any way to get MsgBox columns to line up? columns in last table row don't line up mavisgold Word 1 03-26-2017 02:32 AM
Formatting the line between columns in Word Mac 2011 bpanda Word 1 06-03-2013 07:52 PM
Is there any way to get MsgBox columns to line up? Make MsgBox appear... Jamtart PowerPoint 3 09-01-2012 08:21 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:27 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft