pcc
Well-known Member
- Joined
- Jan 21, 2003
- Messages
- 1,353
I have the code below courtesy of this forum, that allows the current workbook to be posted as an attachement in an E-mail sent to a public folder on the company's Outlook system, and this works fine.
What I would ideally like to do is post the workbook itself (ie not as an E-mail attachment). The only way I know is to drag and drop the file from Explorer to Outlook, but I would like to do this using Excel VB. Can anyone offer any assisatance?
Thanks
Code:
Sub test_code()
Dim nam As String
nam = "Bid sheet update"
Dim EmailTo As String 'email to the public folders
Dim oApp As Object 'Outlook.Application
Dim oItem As Object 'Outlook.MailItem
Dim recipients As String
recip = "foldername@companyname.com"
Set oApp = CreateObject("Outlook.Application")
Set oItem = oApp.CreateItem(0)
With oItem
.To = recip
.Subject = nam
.Body = "Some text here"
.attachments.Add ActiveWorkbook.FullName
.Importance = 0 ' 2= HIGH importance, Low = 0, Medium = 1
.Send
End With
Set oItem = Nothing
Set oApp = Nothing
End Sub
What I would ideally like to do is post the workbook itself (ie not as an E-mail attachment). The only way I know is to drag and drop the file from Explorer to Outlook, but I would like to do this using Excel VB. Can anyone offer any assisatance?
Thanks