Results 1 to 1 of 1

How to get a tab like when pressing tab on the Keyboard

Threaded View

  1. #1
    Registered User
    Join Date
    08-07-2012
    Location
    California, USA
    MS-Off Ver
    Excel 2010
    Posts
    9

    How to get a tab like when pressing tab on the Keyboard

    Hello, I've got a macro I've made in excel that'll create an email in Outlook. I want to be able to put this in the body:

    Racks: "Date" - "Date"
    Wire: "Date" - "Date"
    Cabinet: "Date" - "Date"

    Where the tabs will line up with each other so that each Date starts on the same line. but when I try using vbTab or Chr(9) I only get a group of five spaces, instead of a tab (like pressing the tab button on the keyboard in the body of an email).
    here is a simplifed version of my macro

    Option Explicit
    Private Sub Workbook_Open()
    
        Dim OLapp As Outlook.Application
        Dim OLmsg As Outlook.MailItem
    
        RackText = "Racks:" & vbTab & vbTab & Format("Date", "m/d/yy") & " - " & Format("Date", "m/d/yy") & Chr(10)
        WireText = "Wire:" & vbTab & vbTab & Format("Date", "m/d/yy") & " - " & Format("Date", "m/d/yy") & Chr(10)
        CabText = "Cabinet:" & vbTab & vbTab & Format("Date", "m/d/yy") & " - " & Format("Date", "m/d/yy") & Chr(10)
    
    
        With OLmsg
            .Body = RackText & WireText & CabText
            .Display
        End With
    
    End Sub
    Thank you for any help you are able to give me
    Last edited by jsunnb; 10-04-2012 at 01:12 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1