How would I send an email by pressing a button that would send an excel spreadsheet by microsoft outlook and how would I set the function up?
Please help me
How would I send an email by pressing a button that would send an excel spreadsheet by microsoft outlook and how would I set the function up?
Please help me
Here you go.
'automatically answers "yes" to the dialog security box in Outlook
Set fso = CreateObject("Scripting.FileSystemObject")
Set fsofile = fso.CreateTextFile("ByPass.vbs")
fsofile.writeline "set fso = createobject(""wscript.shell"")"
fsofile.writeline "while fso.appactivate(""microsoft outlook"") =false"
fsofile.writeline "wscript.sleep 1000"
fsofile.writeline "wend"
fsofile.writeline "fso.sendkeys ""a"", true"
fsofile.writeline "fso.sendkeys ""y"", true"
fsofile.writeline "wscript.sleep 7000"
fsofile.writeline "while fso.appactivate(""microsoft outlook"") =false"
fsofile.writeline "wscript.sleep 1000"
fsofile.writeline "wend"
fsofile.writeline "fso.sendkeys ""y"", true"
fsofile.Close
Set wshShell = CreateObject("Wscript.Shell")
wshShell.Run ("ByPass.vbs")
'send out chart
Set varOutApp = CreateObject("Outlook.Application")
Set varSendIt = varOutApp.CreateItem(0)
With varSendIt
.To = "whoever"
.Subject = " Report"
.Body = " put message here"
.Attachments.Add ("\\server\share\directory\" & varFileName)
.Send
End With
Set varOutApp = Nothing
Set varSendIt = Nothing
End Sub
Display More
I tried using the above and I still got the object model guard prompt from outlook. Any ideas?
Try looking up SendMail in the help files.
Do you know anything about creating a dynamic array of sheets (in VBA) based on name?
I am trying to use a for statement and it will not create an array
I have moved your question to to the correct forum. Search the answers here and you will find what you need.
Re: Sending an email
Quote from ascaleseI tried using the above and I still got the object model guard prompt from outlook. Any ideas?
Same with me.
I am having the same problem. I did a search and it came up with this thread.
I just tried the code and it's not working for me either,
fifijazz, do you have any more suggestions?
or does anybody here any any ideas.
perhaps...something is missing from the code...?
Don’t have an account yet? Register yourself now and be a part of our community!