Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting a specific line position, with the Send Object

Status
Not open for further replies.

Delboy14

Programmer
Jun 21, 2001
213
GB
VBA Access

I am using VBA to send an automated email, using data from an Access table, the email works fine I just have a slight query with formatting.

is there a way to tell the send object to go to a particular position in a line.

Code:
eg 
message= rs.Fields("forname") & position("25") & rs.Fields("surname") & newline
I know how to use tab, and new line, but would like to set a specific position so that, unusually long field values do not skew the formatting. Thanks for any help in advance
 
Try this

message= rs.Fields("forname") & Space$(25) & rs.Fields("surname") & newline

Hope this helps.
If you choose to battle wits with the witless be prepared to lose.
[machinegun][hammer]
 
foada, you example will add 25 spaces, I think Delboy14 wants the surname to start at posistion 25. That can be done:
------------------------------------------------
Const MaxLength = 255
Dim message As Strings
message = Space(MaxLength)
Mid$(message, 1) = fs.Fields("forname")
Mid$(message, 25) = fs.Fields("surname")
message = trim$(message)
------------------------------------------------


Eller maaske skulle jeg skrive paa dansk til Delboy14? Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
 
sunaj,

You are correct, I have been up for 30 some hours straight and did not read the question completely. Sorry. If you choose to battle wits with the witless be prepared to lose.
[machinegun][hammer]
 
How can you do this with a record set eg

I am printing out the names in a loop and adding them all to the same message, but using the code above from, sunaj I seem to lose all the details in the email

Forname Surname

Derek Smith
Frank Do
Brian Wells
 
Because there are more than 255 characters in total?

Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
 
Yes there are, but changing the char number does not seem to help. I think it may be something to do with the email message, adding this part of the message as part of the whole message, no worries I will keep trying :cool:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top