Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default vbNewLine not working?

I have a userform, and the idea being that people can fill it in with
information and hit the send button, which whisks it away.

I want the information split into lines so its easier to read, rather than
it being a long string.

..HTMLBody = TextBox1.Value & vbCr & TextBox2.Value & vbCrLf & TextBox3.Value
& vbNewLine & TextBox4.Value

trying different types of new line to try and get one of them to work. But I
still end up with all the information in 1 line, all next to each other.....

Full macro:

Private Sub CommandButton1_Click()
Dim iMsg As Object
Dim iConf As Object
Dim sh As Worksheet
Dim rng As Range
Dim Flds As Variant
Dim nam As Variant

nam = Environ("UserName")

Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")

iConf.Load -1 ' CDO Source Defaults
Set Flds = iConf.Fields
With Flds

..Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

..Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "XXX"

..Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

..Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 0
.Update
End With


Application.ScreenUpdating = False
With iMsg
Set .Configuration = iConf
.To = "
.CC = ""
.BCC = ""
.From = """Pre Visit Call Missed"" <no@ddress"
.Subject = "Completed by " & nam
.HTMLBody = TextBox1.Value & vbCr & TextBox2.Value & vbCrLf &
TextBox3.Value & vbNewLine & TextBox4.Value & vbCrLf & TextBox5.Value &
vbCrLf & TextBox6.Value & vbCrLf & TextBox7.Value
.Send
End With

Set iMsg = Nothing
Set iConf = Nothing

Unload Me
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 324
Default vbNewLine not working?

Try vbLineSpace
--
Best wishes,

Jim


"PaulW" wrote:

I have a userform, and the idea being that people can fill it in with
information and hit the send button, which whisks it away.

I want the information split into lines so its easier to read, rather than
it being a long string.

.HTMLBody = TextBox1.Value & vbCr & TextBox2.Value & vbCrLf & TextBox3.Value
& vbNewLine & TextBox4.Value

trying different types of new line to try and get one of them to work. But I
still end up with all the information in 1 line, all next to each other.....

Full macro:

Private Sub CommandButton1_Click()
Dim iMsg As Object
Dim iConf As Object
Dim sh As Worksheet
Dim rng As Range
Dim Flds As Variant
Dim nam As Variant

nam = Environ("UserName")

Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")

iConf.Load -1 ' CDO Source Defaults
Set Flds = iConf.Fields
With Flds

.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "XXX"

.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 0
.Update
End With


Application.ScreenUpdating = False
With iMsg
Set .Configuration = iConf
.To = "
.CC = ""
.BCC = ""
.From = """Pre Visit Call Missed"" <no@ddress"
.Subject = "Completed by " & nam
.HTMLBody = TextBox1.Value & vbCr & TextBox2.Value & vbCrLf &
TextBox3.Value & vbNewLine & TextBox4.Value & vbCrLf & TextBox5.Value &
vbCrLf & TextBox6.Value & vbCrLf & TextBox7.Value
.Send
End With

Set iMsg = Nothing
Set iConf = Nothing

Unload Me
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default vbNewLine not working?

Didn't work :/

"Jim Jackson" wrote:

Try vbLineSpace
--
Best wishes,

Jim


"PaulW" wrote:

I have a userform, and the idea being that people can fill it in with
information and hit the send button, which whisks it away.

I want the information split into lines so its easier to read, rather than
it being a long string.

.HTMLBody = TextBox1.Value & vbCr & TextBox2.Value & vbCrLf & TextBox3.Value
& vbNewLine & TextBox4.Value

trying different types of new line to try and get one of them to work. But I
still end up with all the information in 1 line, all next to each other.....

Full macro:

Private Sub CommandButton1_Click()
Dim iMsg As Object
Dim iConf As Object
Dim sh As Worksheet
Dim rng As Range
Dim Flds As Variant
Dim nam As Variant

nam = Environ("UserName")

Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")

iConf.Load -1 ' CDO Source Defaults
Set Flds = iConf.Fields
With Flds

.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "XXX"

.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 0
.Update
End With


Application.ScreenUpdating = False
With iMsg
Set .Configuration = iConf
.To = "
.CC = ""
.BCC = ""
.From = """Pre Visit Call Missed"" <no@ddress"
.Subject = "Completed by " & nam
.HTMLBody = TextBox1.Value & vbCr & TextBox2.Value & vbCrLf &
TextBox3.Value & vbNewLine & TextBox4.Value & vbCrLf & TextBox5.Value &
vbCrLf & TextBox6.Value & vbCrLf & TextBox7.Value
.Send
End With

Set iMsg = Nothing
Set iConf = Nothing

Unload Me
End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 324
Default vbNewLine not working?

Sorry. It works for me in InputBoxes so I was hoping it work in your
situation. Maybe somebody else will have the right answer.
--
Best wishes,

Jim


"PaulW" wrote:

Didn't work :/

"Jim Jackson" wrote:

Try vbLineSpace
--
Best wishes,

Jim


"PaulW" wrote:

I have a userform, and the idea being that people can fill it in with
information and hit the send button, which whisks it away.

I want the information split into lines so its easier to read, rather than
it being a long string.

.HTMLBody = TextBox1.Value & vbCr & TextBox2.Value & vbCrLf & TextBox3.Value
& vbNewLine & TextBox4.Value

trying different types of new line to try and get one of them to work. But I
still end up with all the information in 1 line, all next to each other.....

Full macro:

Private Sub CommandButton1_Click()
Dim iMsg As Object
Dim iConf As Object
Dim sh As Worksheet
Dim rng As Range
Dim Flds As Variant
Dim nam As Variant

nam = Environ("UserName")

Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")

iConf.Load -1 ' CDO Source Defaults
Set Flds = iConf.Fields
With Flds

.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "XXX"

.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 0
.Update
End With


Application.ScreenUpdating = False
With iMsg
Set .Configuration = iConf
.To = "
.CC = ""
.BCC = ""
.From = """Pre Visit Call Missed"" <no@ddress"
.Subject = "Completed by " & nam
.HTMLBody = TextBox1.Value & vbCr & TextBox2.Value & vbCrLf &
TextBox3.Value & vbNewLine & TextBox4.Value & vbCrLf & TextBox5.Value &
vbCrLf & TextBox6.Value & vbCrLf & TextBox7.Value
.Send
End With

Set iMsg = Nothing
Set iConf = Nothing

Unload Me
End Sub

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 324
Default vbNewLine not working?

I found this bit of code and hoped something in it might be of use.

Const NewFileName = "NewFile.txt"
Const SourceFileName = "source.txt"

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(SourceFileName)
strLines = Split(objFile.ReadAll,vbcrlf)
objFile.Close
Set NewFile = objFSO.CreateTextFile(NewFileName, True)
For Each strLine in strLines
if strLine<"" Then
Arr = Split(strLine,",")
NewLine = ""
for x = 0 To 3
NewLine = NewLine & Arr(x) & ","
next
NewLine = replace(NewLine,Chr(34),"")
NewLine = "dn: " & Left(NewLine,Len(NewLine)-1) & vbNewLine
NewLine = NewLine & "changetype: modify" & vbNewLine
NewLine = NewLine & "replace: employeeID" & vbNewLine
NewLine = NewLine & "employeeID: " & Arr(4) & vbNewLine
NewLine = NewLine & "-" & vbNewLine
NewFile.WriteLine NewLine
end if
Next
NewFile.Close

--
Best wishes,

Jim


"PaulW" wrote:

Didn't work :/

"Jim Jackson" wrote:

Try vbLineSpace
--
Best wishes,

Jim


"PaulW" wrote:

I have a userform, and the idea being that people can fill it in with
information and hit the send button, which whisks it away.

I want the information split into lines so its easier to read, rather than
it being a long string.

.HTMLBody = TextBox1.Value & vbCr & TextBox2.Value & vbCrLf & TextBox3.Value
& vbNewLine & TextBox4.Value

trying different types of new line to try and get one of them to work. But I
still end up with all the information in 1 line, all next to each other.....

Full macro:

Private Sub CommandButton1_Click()
Dim iMsg As Object
Dim iConf As Object
Dim sh As Worksheet
Dim rng As Range
Dim Flds As Variant
Dim nam As Variant

nam = Environ("UserName")

Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")

iConf.Load -1 ' CDO Source Defaults
Set Flds = iConf.Fields
With Flds

.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "XXX"

.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 0
.Update
End With


Application.ScreenUpdating = False
With iMsg
Set .Configuration = iConf
.To = "
.CC = ""
.BCC = ""
.From = """Pre Visit Call Missed"" <no@ddress"
.Subject = "Completed by " & nam
.HTMLBody = TextBox1.Value & vbCr & TextBox2.Value & vbCrLf &
TextBox3.Value & vbNewLine & TextBox4.Value & vbCrLf & TextBox5.Value &
vbCrLf & TextBox6.Value & vbCrLf & TextBox7.Value
.Send
End With

Set iMsg = Nothing
Set iConf = Nothing

Unload Me
End Sub



  #6   Report Post  
Posted to microsoft.public.excel.programming
Tim Tim is offline
external usenet poster
 
Posts: 145
Default vbNewLine not working?

Use "<br" if you're composing HTML.
HTML tends to ignore whitespace other than a single space character.

Or wrap all content in <pre</pre

Tim


"PaulW" wrote in message
...
I have a userform, and the idea being that people can fill it in with
information and hit the send button, which whisks it away.

I want the information split into lines so its easier to read, rather than
it being a long string.

.HTMLBody = TextBox1.Value & vbCr & TextBox2.Value & vbCrLf &
TextBox3.Value
& vbNewLine & TextBox4.Value

trying different types of new line to try and get one of them to work. But
I
still end up with all the information in 1 line, all next to each
other.....

Full macro:

Private Sub CommandButton1_Click()
Dim iMsg As Object
Dim iConf As Object
Dim sh As Worksheet
Dim rng As Range
Dim Flds As Variant
Dim nam As Variant

nam = Environ("UserName")

Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")

iConf.Load -1 ' CDO Source Defaults
Set Flds = iConf.Fields
With Flds

.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "XXX"

.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") =
25

.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") =
0
.Update
End With


Application.ScreenUpdating = False
With iMsg
Set .Configuration = iConf
.To = "
.CC = ""
.BCC = ""
.From = """Pre Visit Call Missed"" <no@ddress"
.Subject = "Completed by " & nam
.HTMLBody = TextBox1.Value & vbCr & TextBox2.Value & vbCrLf &
TextBox3.Value & vbNewLine & TextBox4.Value & vbCrLf & TextBox5.Value &
vbCrLf & TextBox6.Value & vbCrLf & TextBox7.Value
.Send
End With

Set iMsg = Nothing
Set iConf = Nothing

Unload Me
End Sub



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default vbNewLine not working?

D'oh, didn't think to try HTML, cheers.

"Tim" wrote:

Use "<br" if you're composing HTML.
HTML tends to ignore whitespace other than a single space character.

Or wrap all content in <pre</pre

Tim


"PaulW" wrote in message
...
I have a userform, and the idea being that people can fill it in with
information and hit the send button, which whisks it away.

I want the information split into lines so its easier to read, rather than
it being a long string.

.HTMLBody = TextBox1.Value & vbCr & TextBox2.Value & vbCrLf &
TextBox3.Value
& vbNewLine & TextBox4.Value

trying different types of new line to try and get one of them to work. But
I
still end up with all the information in 1 line, all next to each
other.....

Full macro:

Private Sub CommandButton1_Click()
Dim iMsg As Object
Dim iConf As Object
Dim sh As Worksheet
Dim rng As Range
Dim Flds As Variant
Dim nam As Variant

nam = Environ("UserName")

Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")

iConf.Load -1 ' CDO Source Defaults
Set Flds = iConf.Fields
With Flds

.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "XXX"

.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") =
25

.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") =
0
.Update
End With


Application.ScreenUpdating = False
With iMsg
Set .Configuration = iConf
.To = "
.CC = ""
.BCC = ""
.From = """Pre Visit Call Missed"" <no@ddress"
.Subject = "Completed by " & nam
.HTMLBody = TextBox1.Value & vbCr & TextBox2.Value & vbCrLf &
TextBox3.Value & vbNewLine & TextBox4.Value & vbCrLf & TextBox5.Value &
vbCrLf & TextBox6.Value & vbCrLf & TextBox7.Value
.Send
End With

Set iMsg = Nothing
Set iConf = Nothing

Unload Me
End Sub




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 324
Default vbNewLine not working?

I'm in the boat with you. I have used "<br" plenty of times but my
"one-tracked mind" couldn't get the track switchto work.
--
Best wishes,

Jim


"PaulW" wrote:

D'oh, didn't think to try HTML, cheers.

"Tim" wrote:

Use "<br" if you're composing HTML.
HTML tends to ignore whitespace other than a single space character.

Or wrap all content in <pre</pre

Tim


"PaulW" wrote in message
...
I have a userform, and the idea being that people can fill it in with
information and hit the send button, which whisks it away.

I want the information split into lines so its easier to read, rather than
it being a long string.

.HTMLBody = TextBox1.Value & vbCr & TextBox2.Value & vbCrLf &
TextBox3.Value
& vbNewLine & TextBox4.Value

trying different types of new line to try and get one of them to work. But
I
still end up with all the information in 1 line, all next to each
other.....

Full macro:

Private Sub CommandButton1_Click()
Dim iMsg As Object
Dim iConf As Object
Dim sh As Worksheet
Dim rng As Range
Dim Flds As Variant
Dim nam As Variant

nam = Environ("UserName")

Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")

iConf.Load -1 ' CDO Source Defaults
Set Flds = iConf.Fields
With Flds

.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "XXX"

.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") =
25

.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") =
0
.Update
End With


Application.ScreenUpdating = False
With iMsg
Set .Configuration = iConf
.To = "
.CC = ""
.BCC = ""
.From = """Pre Visit Call Missed"" <no@ddress"
.Subject = "Completed by " & nam
.HTMLBody = TextBox1.Value & vbCr & TextBox2.Value & vbCrLf &
TextBox3.Value & vbNewLine & TextBox4.Value & vbCrLf & TextBox5.Value &
vbCrLf & TextBox6.Value & vbCrLf & TextBox7.Value
.Send
End With

Set iMsg = Nothing
Set iConf = Nothing

Unload Me
End Sub




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculate working days but change working week SamB Excel Discussion (Misc queries) 1 September 1st 08 09:17 PM
Making weekend days working days - the system cuts the working tim Fluffy Excel Discussion (Misc queries) 1 May 30th 08 10:02 PM
Newly created Get Function is not working when I copied the syntax from a working function CJ Excel Programming 1 January 16th 07 05:28 AM
Macro working in Excel 2003; not working in Excel 2000 Leslie Barberie Excel Programming 5 May 20th 04 07:51 PM
Adding sales from a non working day to the previous working day Alex Excel Programming 1 September 19th 03 08:48 AM


All times are GMT +1. The time now is 10:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"