Tab spacing and border around textbox.value for email and change date to english format not american?

Patriot2879

Well-known Member
Joined
Feb 1, 2018
Messages
1,227
Office Version
  1. 2010
Platform
  1. Windows
Hi, i have the code below i was wondering if you can help me with it please, i have entered textbox18, textbox19, and textbox20 anfd this brings back the date into the email but it is in american format how can i change this please in the code?
Also after each textbox i have entered a vbtab, but i want them inline for top and bottom ie the date and area lines how can i do this please?


Code:
Private Sub CommandButton1_Click()

Dim aOutlook As Object
Dim aEmail As Object
Dim rngeAddresses As Range, rngeCell As Range, strRecipients As String

Set aOutlook = CreateObject("Outlook.Application")
Set aEmail = aOutlook.CreateItem(0)

        aEmail.Body = "Hi There," & Chr(10) & vbCrLf & _
                      "" & Me.TextBox33.Value & Chr(10) & _
                      "Date:" & vbTab & Me.TextBox18.Value & vbTab & Me.TextBox19.Value & vbTab & Me.TextBox21.Value & vbCrLf & _
                      "Area:" & vbTab & Me.TextBox9.Value & vbTab & vbTab & Me.TextBox20.Value & vbTab & vbTab & Me.TextBox22.Value & vbCrLf & _
                      "" & Me.TextBox17.Value & Chr(10) & vbCrLf & _
                      "Many thanks " & Chr(10)

        aEmail.Recipients.Add "test.test@test.com; test.test@test.com"
        aEmail.CC = ""
        aEmail.BCC = ""
        aEmail.Subject = "Weekly " & Range("D2").Value
        aEmail.Display
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Hiya again :) would it be possible to dictate how many spaces i want inbetween each Text box? for example 5 spaces then the next could be 7 spaces gap?
 
Upvote 0
Hiya sorry just wondering if you have any ideas on how to help me with this please? ANy help will be much apprecaited :)
1. I have entered textbox18, textbox19, and textbox20 anfd this brings back the date into the email but it is in american format how can i change this please in the code?
Code:
"Date:" & vbTab & Me.TextBox18.Value & vbTab & Me.TextBox19.Value & vbTab & Me.TextBox21.Value & vbCrLf & _

2. After each textbox i have entered a vbtab, but i want them inline for top "Date"and bottom "Area" ie the date and area lines how can i do this please?
Code:
"Area:" & vbTab & Me.TextBox9.Value & vbTab & vbTab & Me.TextBox20.Value & vbTab & vbTab & Me.TextBox22.Value & vbCrLf & _
 
Upvote 0
Hi Sorry me again, :) just wondering if you had any ideas at all please? your help and advice is always excellent :) and i am very grateful :)
 
Upvote 0
hi, just had an idea now on the below code, i was wondering instead of having a TextBox18.value is there any way i can change this to copyint the actual textbox into the email? so to copy the textbox and paste into the email? please can you help

Code:
Private Sub CommandButton1_Click()

Dim aOutlook As Object
Dim aEmail As Object
Dim rngeAddresses As Range, rngeCell As Range, strRecipients As String

Set aOutlook = CreateObject("Outlook.Application")
Set aEmail = aOutlook.CreateItem(0)

        aEmail.Body = "Hi There," & Chr(10) & vbCrLf & _
                      "" & Me.TextBox33.Value & Chr(10) & _
                      "Date:" & vbTab & Me.TextBox18.Value & vbTab & Me.TextBox19.Value & vbTab & Me.TextBox21.Value & vbCrLf & _
                      "Area:" & vbTab & Me.TextBox9.Value & vbTab & vbTab & Me.TextBox20.Value & vbTab & vbTab & Me.TextBox22.Value & vbCrLf & _
                      "" & Me.TextBox17.Value & Chr(10) & vbCrLf & _
                      "Many thanks " & Chr(10)

        aEmail.Recipients.Add "test.test@test.com; test.test@test.com"
        aEmail.CC = ""
        aEmail.BCC = ""
        aEmail.Subject = "Weekly " & Range("D2").Value
        aEmail.Display
 
Upvote 0
Hi Sorry me again, i am new to this and your help is appreciated :) i have the code below which is linked to my email from a userform button where at the moment it transfers all the vlaues from a text box, but at the moment the datew and area lines arent tabbing in line with each other due to the count of characters used, is there any way i can change the .vlaue to a .copy some how? so instead of copying the data in the text box it copies the whole lot ie the textbox and the data into the email? this would then work on the tabbing i think as the textboxes are all the same size. Please can you help me on this issue i have :) many thanks

Code:
Private Sub CommandButton1_Click()

Dim aOutlook As Object
Dim aEmail As Object
Dim rngeAddresses As Range, rngeCell As Range, strRecipients As String

Set aOutlook = CreateObject("Outlook.Application")
Set aEmail = aOutlook.CreateItem(0)

        aEmail.Body = "Hi " & Me.TextBox35.Value & Chr(10) & vbCrLf & _
                      "" & Me.TextBox33.Value & Chr(10) & _
                      "Date:" & vbTab & Me.TextBox18.Value & vbTab & Me.TextBox19.Value & vbTab & Me.TextBox21.Value & vbTab & Me.TextBox23.Value & vbTab & Me.TextBox25.Value & vbTab & Me.TextBox26.Value & vbTab & Me.TextBox27.Value & vbTab & Me.TextBox28.Value & vbCrLf & _
                      "Area:" & vbTab & Me.TextBox9.Value & vbTab & Me.TextBox20.Value & vbTab & Me.TextBox22.Value & vbTab & Me.TextBox24.Value & vbTab & Me.TextBox29.Value & vbTab & Me.TextBox30.Value & vbTab & Me.TextBox31.Value & vbTab & Me.TextBox32.Value & Chr(10) & vbCrLf & _
                      "" & Me.TextBox17.Value & Chr(10) & vbCrLf & _
                      "Many thanks " & Chr(10) & vbCrLf & _
                      "Team " & Chr(10)

        aEmail.Recipients.Add (UserForm1.TextBox36.Value)
        aEmail.CC = (UserForm1.TextBox37.Value)
        aEmail.BCC = ""
        aEmail.Subject = "Weekly " & Range("D2").Value
        aEmail.Display

End Sub
 
Upvote 0
hiya the copying the textboxes mentioned above is for the 2 lines below to go in the email if possible, pleased can you help in copying the actual textbox and the data into the email please?
Code:
                      "Date:" & vbTab & Me.TextBox18.Value & vbTab & Me.TextBox19.Value & vbTab & Me.TextBox21.Value & vbCrLf & _
                      "Area:" & vbTab & Me.TextBox9.Value & vbTab & vbTab & Me.TextBox20.Value & vbTab & vbTab & Me.TextBox22.Value & vbCrLf & _
 
Upvote 0
Hi sorry just wondering if anyone has any ideas on my question please? many thanks
 
Upvote 0

Forum statistics

Threads
1,215,042
Messages
6,122,810
Members
449,095
Latest member
m_smith_solihull

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