Hi Everyone
My first post, I'm new to VBA but have got a lot of help from this site from articules already posted, but this is the first time I cannot find what I'm looking for hence the post.
I'm using Winows 10 64bit with office 2016. I have an excel file that I'd like to create a task from, my code is below. The bit I cannot get to work is the .body which is a table on sheet2 it's a varialbe range which is why I went down the route of a table. But I cannot add this to the body of the task. I can add a string but not the table. I have no preference to how this is done ie if the range is copied to a picture and pasted into the body or anyother way.
Any help would be greatly appreciated.
Thanks
Simon
Sub NewTask()
Dim rng As Range
Set rng = [Table2[#All]]
With CreateObject("Outlook.Application").CreateItem(3)
.Subject = "Stock Requisition Request"
.StartDate = Now
.DueDate = Now
.ReminderSet = True
.Assign
.Recipients.Add Sheets(Sheet4.Name).Cells(1, 1)
.Body = [Table2[#All]]
.Display
End With
End Sub
PS I did read the FAQ and I hope I've posted this correctly
My first post, I'm new to VBA but have got a lot of help from this site from articules already posted, but this is the first time I cannot find what I'm looking for hence the post.
I'm using Winows 10 64bit with office 2016. I have an excel file that I'd like to create a task from, my code is below. The bit I cannot get to work is the .body which is a table on sheet2 it's a varialbe range which is why I went down the route of a table. But I cannot add this to the body of the task. I can add a string but not the table. I have no preference to how this is done ie if the range is copied to a picture and pasted into the body or anyother way.
Any help would be greatly appreciated.
Thanks
Simon
Sub NewTask()
Dim rng As Range
Set rng = [Table2[#All]]
With CreateObject("Outlook.Application").CreateItem(3)
.Subject = "Stock Requisition Request"
.StartDate = Now
.DueDate = Now
.ReminderSet = True
.Assign
.Recipients.Add Sheets(Sheet4.Name).Cells(1, 1)
.Body = [Table2[#All]]
.Display
End With
End Sub
PS I did read the FAQ and I hope I've posted this correctly