Link to home
Start Free TrialLog in
Avatar of hindersaliva
hindersalivaFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Outlook 2010, VBA and Tab question

in Excel VBA I am building up the Body of an email I'm sending in Outlook 2010.

This is my code snippet.

        strbody = "Hi there" & vbNewLine & vbNewLine & _
              "This is line 1" & vbTab & "Email1" & vbTab & "Notes 1" & vbNewLine & _
              "This is line 2" & vbTab & "Email2" & vbTab & "Notes 2" & vbNewLine & _
              "This is line 3" & vbTab & "Email3" & vbTab & "Notes 3" & vbNewLine & _
              "This is line 4" & vbTab & "Email4" & vbTab & "Notes 4"

Open in new window


Now the first column 'This is line 1' could be of variable length. So the Email 1 etc may not line up properly vertically.
Similarly for the Notes column.

Is there an easy way of making the columns line up?

Or, how do I know what the width of the tab is? So that I can work out the length of the string and code the adjustment? (ie. whether I need 1 or 2 tabs to fill the gap)
Avatar of Robberbaron (robr)
Robberbaron (robr)
Flag of Australia image

I would consider setting the mail format to be HTML, then use a html table to align your data.
almost all current email readers understand html formatted messages.

not modern but it works all the time....  you can set min-width on columns and they should autoexpand to the windows size as necessary
Avatar of hindersaliva

ASKER

Yes Robr, I though so too. Can you recommend a link to some know-how on it please?
ASKER CERTIFIED SOLUTION
Avatar of Robberbaron (robr)
Robberbaron (robr)
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hey thanks robr!
That will do me nicely!