danbates77
New Member
- Joined
- Jan 10, 2017
- Messages
- 36
- Office Version
- 2016
Hi,
I am not sure what I'm about to ask is possible but let's see.
I want to be able to send an email via VBA but it can't be through the following code because it doesn't work on my works PC.
I have this code that opens up my email and I was wondering if it could be merged into a code, so it does the same as the code above,but works on my works PC.
Any help would be appreciated
Thanks
Dan
I am not sure what I'm about to ask is possible but let's see.
I want to be able to send an email via VBA but it can't be through the following code because it doesn't work on my works PC.
VBA Code:
Sub Email()
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
' Change the mail address and subject in the macro before you run it.
With OutMail
.to = ""
.to = ""
.CC = ""
.BCC = ""
.Subject = ""
.Body = ""
.Attachments.Add
' You can add other files by uncommenting the following line.
'.Attachments.Add ("C:\test.txt")
' In place of the following statement, you can use ".Display" to
' display the mail.
.Send
End With
On Error GoTo 0
MsgBox "File sent successfully"
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
I have this code that opens up my email and I was wondering if it could be merged into a code, so it does the same as the code above,but works on my works PC.
VBA Code:
Sub EmailNew()
Shell "C:\Windows\explorer.exe C:\Users\Public\Desktop\Microsoft Outlook Web Access.url"
End Sub
Any help would be appreciated
Thanks
Dan