VBA code to put standard string into body of exisiting task

  • Thread starter Thread starter Barbara
  • Start date Start date
B

Barbara

I want to make a script that puts standard textstring into the body of an
open task.
I have found a lot on the internet about the subject, but they all create a
new task. I only want to automate a standard string (like date and name) into
the bodyof an open/active task.
Can somebody help me?
thanks,
Barbara
 
The currently open window is represented by Application.ActiveInspector, thus:

Sub MyMacro()
Dim itm as Object
Dim myString as String
On Error Resume Next
Set itm = Application.ActiveInspector.CurrentItem
If Not itm Is Nothing Then
myString = "some text"
' or
' myString = Now()
itm.Body = myString & vbCrLf & itm.Body
End If
Set itm = Nothing
End If
 
Thank you Sue, that works!
But, in the task I have put a mail item. Normally when I type some text
above it scrolls down, but when I use you code the text scrolls down, but the
message item stays where it was.....is there something to do about that?
if you want I can sent you the example task.
 
Attachment positioning is broken in Outlook 2007 (unless it got fixed in SP1 -- unlikely). If you have an earlier version, you can try changing the value of the Position property for each Attachment in the item's Attachments collection.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 
Back
Top