473,765 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Automatic email with multiple lines

AllusiveKitten
43 New Member
Hi all

I am trying to set up an automatic email that requires multiple lines and paragraphs.

Can someone please help me, the coding I have so far only sustains one continuous line.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command0_Click()
  2.  
  3. Dim Email As String
  4. Dim objOutlook As Outlook.Application
  5. Dim objEmail As Outlook.MailItem
  6.  
  7. Email = "name@company.com"
  8.  
  9. Set objOutlook = CreateObject("Outlook.application")
  10.  
  11. Set objEmail = objOutlook.CreateItem(olMailItem)
  12.  
  13. With objEmail
  14.  
  15.     .To = Email
  16.     .Subject = "Test email document"
  17.     .Body = "This is just a test"
  18.     .Send
  19. End With
  20.  
  21. Set objEmail = Nothing
  22.  
  23. End Sub
Thank you for your help
Oct 18 '07 #1
5 20242
Scott Price
1,384 Recognized Expert Top Contributor
You inadvertently posted your question in the Access Articles section. I have moved it across for you to the main forum.

MODERATOR
Oct 18 '07 #2
Jim Doherty
897 Recognized Expert Contributor
Hi all

I am trying to set up an automatic email that requires multiple lines and paragraphs.

Can someone please help me, the coding I have so far only sustains one continuous line.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command0_Click()
  2.  
  3. Dim Email As String
  4. Dim objOutlook As Outlook.Application
  5. Dim objEmail As Outlook.MailItem
  6.  
  7. Email = "name@company.com"
  8.  
  9. Set objOutlook = CreateObject("Outlook.application")
  10.  
  11. Set objEmail = objOutlook.CreateItem(olMailItem)
  12.  
  13. With objEmail
  14.  
  15. .To = Email
  16. .Subject = "Test email document"
  17. .Body = "This is just a test"
  18. .Send
  19. End With
  20.  
  21. Set objEmail = Nothing
  22.  
  23. End Sub
Thank you for your help

Concatenate your message into a string variable and then assign the variable to the BODY as below demonstrates:

Expand|Select|Wrap|Line Numbers
  1.  Dim mymsg as string 
  2. mymsg = "This is just a test & vbcrlf
  3. mymsg = mymsg & "This is another line" & vbcrlf
  4. mymsg = mymsg & "This is yet another line & vbcrlf & vbcrlf
  5. mymsg = mymsg & "This line has double spaced" 
  6.     .Body = mymsg
  7. .Send
  8.  
Regards

Jim
Oct 18 '07 #3
NeoPa
32,572 Recognized Expert Moderator MVP
Notice the vbCRLF that's used in Jim's code. This is a Carriage Return / Line Feed sequence which essentially means a new line.
That is how it is done :)
Oct 18 '07 #4
AllusiveKitten
43 New Member
Thank you both, you are a great help.
Thank you NeoPa for clarifying the meanings.
Oct 18 '07 #5
NeoPa
32,572 Recognized Expert Moderator MVP
No problem AK - Glad to help :)
Oct 19 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
2444
by: Rasmus Fogh | last post by:
Someone raised the question of automatic code generation a few weeks back. And yes, we (CCPN) are using automatic Python code generation in a major way. Basically we are making data models in UML, and using automatic code generation to make Python APIs, XML I/O etc. (more below). We can be found at http://www.ccpn.ac.uk/index.html As a general point, automtic code generation would seem like a good idea in special cases where:
3
3211
by: Darleen | last post by:
I am seeking conceptual here on how to get started with a "3D Matrix" in Access. We run a training center which holds multiple classes in multiple cities at multiple times. So I need to create a matrix with 3 "axis". The 3 axes are: City Location Week of Class (in 14 week increments that repeat) Name of Class The end goal is to be able to have a form that shows these classes in
5
2375
by: Shane | last post by:
I wonder if someone has any ideas about the following. I am currently producing some reports for a manufacturing company who work with metal. A finished part can contain multiple sub-parts to make up the finished part. The sub-parts can also be made up of sub-parts and those sub-parts can also be made up of sub-parts etc etc. All parts are contained within the same table and I have a seperate table
4
2365
by: pjac | last post by:
I need assistance in creating an Automatic tracking number that appears in a textbox that looks like: 2004-001. The first part of the number is based on the year, the second part is generated from the last available number used. Also, the second part of the number needs to start over whenever a new year is started. for example: 2005-001. Any help would be greatly appreciated. Thanks, pjac
1
11276
by: Philip Bondi | last post by:
Hello to all SQL Server junkies who work with non-English characters: For people running scripts from the command line using ANSI files with special characters, it is very important to use isql and disable "Automatic ANSI to OEM conversion": - This only affects isql from the command line, and no gui applications - http://support.microsoft.com/?scid=kb;EN-US;153449 - Start the "Client Network Utility" C:\WINDOWS\system32\cliconfg.exe
0
2314
by: krouxsa | last post by:
Hi There people... Please help me with this query. I want to send 1 email to multiple email addresses stored in a database. Will it be possible? I'm using SQL Server 2005 and already set up the Database mail. I also tested the mail and it works fine. My problem is sending mail to multiple emails recipients stored in a Database
5
1763
AllusiveKitten
by: AllusiveKitten | last post by:
Hi all, I really hope I can explain myself properly, I have set up coding to send multiple automatic emails which is working super! Each email that is being sent I receive the security Pop up box that say someone is trying to send an email on behalf of myser. My question is, is there a code I can put in for when someone presses the No button because at the moment when it is pressed, I am getting a debug error. Thank you for you help AK
10
3054
by: karan1981 | last post by:
Hi, I have a user control that has a textbox. This user control is placed in a form at runtime. This form gives a string to the user control and the textbox is to show this in multiple lines.(i do so using a property to set the textbox's text property) So in designer view i set the multiline property to TRUE and the word wrap property to TRUE. This enables the text to be shown in multiple lines at runtime. But the textbox size does not...
12
10650
by: DeZZar | last post by:
Hi all, I'll explain my database first. Users input customer details that are required to complete a company document. The document merge etc is all working - the database saves the completed document to a variable directory based on form data. What I need to code into it now is a button that creates an email. The email has the same basic text each time but just needs to draw a
0
9398
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9832
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8831
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7378
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5421
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2805
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.