Hello,
A simple request I am sure, but I am unclear of the procedure. I have limited experience with VB, so here goes:
I am trying to create a simple VB application that will bring up a form box with a TextInput for an email address and a SEND (caption) button only.
The function of this application will, when the SEND button is clicked Outlook 2010 will:
1. Open and populate the To: field with the email address from the Text Box input.
2. Attach a file rom a specified folder (same with all outgoing emails)
3. Close Outlook
Basically our secretary should have this Form Input box on her desktop, type an email address and hit SEND.
Any detailed assistance is appreciated.
In Outlook press ALT+F10
Create a new 'UserForm', and add a Textbox, and a Button on it.
Give the butten a correct name, and doubleclick it.
enter next code: -
Private Sub Send_Click()
-
Dim msg As Outlook.MailItem
-
Set msg = Application.CreateItem(olMailItem)
-
msg.Subject = "Hello World!"
-
msg.To = Me.TextBox1.Value
-
msg.Attachments.Add "c:\temp\test.pdf", olByValue, 2, "test"
-
UserForm1.Hide
-
msg.Send
-
Set msg = Nothing
-
End Sub
-
-
after that, rightclick on 'Modules', and create a module with next code: -
Sub mailthis()
-
UserForm1.Show
-
End Sub
-
save everything,
a shotcurt with the following command should start tha macro (providing the names are equal): - "C:\Program Files\Microsoft Office 15\root\office15\outlook.exe" /autorun "Project1.mailthis"
5 4271 Luuk 1,047
Expert 1GB
What about the 'Right Click'/'Send to'/'Mail recipient'?
If your secretary is not smart enough to do that, your secretary should get a basic computer course.
This will benefit you, and your company.
An option, yes...but there is a reason for the method I have inquired about!
Luuk 1,047
Expert 1GB
In Outlook press ALT+F10
Create a new 'UserForm', and add a Textbox, and a Button on it.
Give the butten a correct name, and doubleclick it.
enter next code: -
Private Sub Send_Click()
-
Dim msg As Outlook.MailItem
-
Set msg = Application.CreateItem(olMailItem)
-
msg.Subject = "Hello World!"
-
msg.To = Me.TextBox1.Value
-
msg.Attachments.Add "c:\temp\test.pdf", olByValue, 2, "test"
-
UserForm1.Hide
-
msg.Send
-
Set msg = Nothing
-
End Sub
-
-
after that, rightclick on 'Modules', and create a module with next code: -
Sub mailthis()
-
UserForm1.Show
-
End Sub
-
save everything,
a shotcurt with the following command should start tha macro (providing the names are equal): - "C:\Program Files\Microsoft Office 15\root\office15\outlook.exe" /autorun "Project1.mailthis"
Perfect, thank you Luuk, that does work! Keeping the form open is perfect, however the line for closing Outlook upon sending is what I also need.
I played with the following, but unable to mesh:
objMail.Send
objOutlook.Quit
Set objMail = Nothing
Set objOutlook = Nothing
Luuk 1,047
Expert 1GB
will close Outlook,
but only if the mail is already send,
otherwise some notification is show about Outlook being busy sending a mail.....
Sign in to post your reply or Sign up for a free account.
Similar topics
by: joe215 |
last post by:
I want my users to send emails from a Windows app that I am developing in
Visual Basic.NET 2003. I found a good example of sending email to a SMTP
server using the SmtpMail class. However, using...
|
by: Bonj |
last post by:
Right guys.
(I would like a solution to this in VB6 as this is what our needy app is
written in, but any solutions that involve .NET would be much appreciated
likewise as I could instantiate...
|
by: Frank |
last post by:
I think I've confused myself completely here :-)
I have used System.Web.Mail, but am not sure if this works with Exchange Server 5.5. I asked the client if they're email server supported SMTP, and...
|
by: =?Utf-8?B?QXJuZSBCZXJ1bGRzZW4=?= |
last post by:
In my vb.net 2005 app ...I'm sending email via Outlook 2003. How do I
eliminate that annoying outlook box when sending the email.
Thanks
|
by: Paridevi |
last post by:
Hai ,
i want to send email in .Net Using OutLook Express,My Project is Web Application using vb.Net 2003 with SQL Server 2000.I have searched a lot in Google, but ican't get any...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
| | |