Trouble with space padding in VBA OutMail

sailor_liam

New Member
Joined
Feb 10, 2016
Messages
1
Good day,

I am trying to convert data from an excel spreadsheet into an e-mail via an excel macro (OutMail). The purpose of this e-mail is to inform individuals of their outstanding invoices, with the top line being categories of days outstanding:

"|CURRENT |31-60 |61-90 |91-120 |151-180 |180+ |"

And the line below it inputting the amount they owe for each category, for example:

"|0 |$2,000.00 |0 |0 |$555.55 |0 |"

The above example is to tell the recipient that $2,000 is 31-60 days late, and $555.55 is 151-180 days late.

The numbers in the second line are pulled from the spreadsheet, and the goal is to have the "|" (aka pipes) line up for the first row and second row.

I've been using code similar to the pseudo code below to pad the spaces to line up the pipes:

Line2 = "|" & AmountOwed & Space(25 - Len(AmountOwed)) & "|"

However due to the different point sizes between the numbers, separators and periods, these lines do not line up well at all.

Question: Is there a method to pad the empty space after the amount owed to have each pipe line up perfectly?

Thanks!
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
in all honesty, it maybe quicker to select / grab an image of the area, that is in the grid, and paste that in the post, you then won't need the pipes, and it will line up

not sure the best way to code that though
 
Upvote 0

Forum statistics

Threads
1,216,084
Messages
6,128,728
Members
449,465
Latest member
TAKLAM

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top