Advertisement

There's no such thing as a stupid question, but they're the easiest to answer.
Login
Search

Advertisement

Business Applications Business Applications
Search Search
Search for:
Tech Support Guy > > >

Solved: Excel VBA code to email as attachment


(!)

KainAussie's Avatar
KainAussie KainAussie is offline
Member with 9 posts.
THREAD STARTER
 
Join Date: Jun 2012
Experience: Beginner
17-Jun-2012, 08:46 AM #1
Solved: Excel VBA code to email as attachment
Hi,

could some one please help me here is what i have

i have a excel spreadsheet with data and formulas in it for a quote for a mates pc business he wants me to make him a template
and he needs the code so when he runs the code it comes up with a input box asking for the users email to send it to and all of the emails with the subject "Quote"
can some one please help me?
Keebellah's Avatar
Keebellah   (Hans) Keebellah is offline Keebellah is a Trusted Advisor with special permissions. Keebellah has a Profile Picture
Computer Specs
Trusted Advisor with 5,271 posts.
 
Join Date: Mar 2008
Location: Oegstgeest, The Netherlands
Experience: Advanced
17-Jun-2012, 09:42 AM #2
Here's some code I gave other postyers with similar questions.

Code:
Option Explicit

Function MailData(mSubject As String, mMessage As String, Sendto As String, Optional CCto As String)
Dim eSubject As String, Sendto As String, CCto As String, EBody As String
Dim app As Object, Itm As Variant
Set app = CreateObject("Outlook.Application")
Set Itm = app.CreateItem(0)

With Itm
    .Subject = mSubject
    .To = Sendto
    If Not IsMissing(CCto) Then .CC = CCto
    .Body = mMessage
'     .Attachments.Add (NewFileName1) ' Must be complete path
    .Display ' This property is used when you want
'    .send
End With
Set app = Nothing
Set Itm = Nothing
End Function
You will need to write the macro that passes the data to it'.

With some trial and error you'll probably work it out.

I can advice the link below to find almost everything you may need regarding VBA and it includes many (ex)/(s)amples

http://www.rondebruin.nl/tips.htm

If you get stuck just holler
KainAussie's Avatar
KainAussie KainAussie is offline
Member with 9 posts.
THREAD STARTER
 
Join Date: Jun 2012
Experience: Beginner
17-Jun-2012, 09:49 AM #3
if i put that code in a command button it will work?
i no nothing about VBA
if not can you tell me what i need to add?
Keebellah's Avatar
Keebellah   (Hans) Keebellah is offline Keebellah is a Trusted Advisor with special permissions. Keebellah has a Profile Picture
Computer Specs
Trusted Advisor with 5,271 posts.
 
Join Date: Mar 2008
Location: Oegstgeest, The Netherlands
Experience: Advanced
17-Jun-2012, 02:44 PM #4
I need to knwo what you have.
Guessing isn't one of my stongest abilities

I would need more info and a sample. The code I passed you won't do anything on it's own and a lack of VBA knowledge won't make it easier, but if you post a sample of your file with let's say 5 dummy records and tell me exactly what you want / expect to do I'will gladly try my best.
No promises but who knows.
KainAussie's Avatar
KainAussie KainAussie is offline
Member with 9 posts.
THREAD STARTER
 
Join Date: Jun 2012
Experience: Beginner
17-Jun-2012, 06:14 PM #5
its all good i solved it found a way online
Keebellah's Avatar
Keebellah   (Hans) Keebellah is offline Keebellah is a Trusted Advisor with special permissions. Keebellah has a Profile Picture
Computer Specs
Trusted Advisor with 5,271 posts.
 
Join Date: Mar 2008
Location: Oegstgeest, The Netherlands
Experience: Advanced
18-Jun-2012, 12:44 AM #6
Good , don't forget to press the 'Marked Solved" button to close the post
As Seen On

BBC, Reader's Digest, PC Magazine, Today Show, Money Magazine
WELCOME TO TECH SUPPORT GUY!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.


(clock)
THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


WELCOME
You Are Using: Server ID
Trusted Website Back to the Top ↑