msoutlook.org Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

VBA code to put standard string into body of exisiting task

 
Post new topic   Reply to topic    msoutlook.org Forum Index -> Outlook Program VBA
Author Message
Barbara



Joined: 12 Aug 2007
Posts: 2

PostPosted: Fri Jan 18, 2008 10:02 am    Post subject: VBA code to put standard string into body of exisiting task Reply with quote

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

Archived from group: microsoft>public>outlook>program_vba
Back to top
View user's profile Send private message
Sue Mosher [MVP-Outlook]



Joined: 12 Aug 2007
Posts: 656

PostPosted: Fri Jan 18, 2008 1:21 pm    Post subject: Re: VBA code to put standard string into body of exisiting t Reply with quote

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

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


"Barbara" wrote in message @microsoft.com...
>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
Back to top
View user's profile Send private message
Barbara



Joined: 12 Aug 2007
Posts: 2

PostPosted: Fri Jan 18, 2008 11:19 am    Post subject: Re: VBA code to put standard string into body of exisiting t Reply with quote

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.

"Sue Mosher [MVP-Outlook]" wrote:

> 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
>
> --
> Sue Mosher, Outlook MVP
> Author of Microsoft Outlook 2007 Programming:
> Jumpstart for Power Users and Administrators
> http://www.outlookcode.com/article.aspx?id=54
>
>
> "Barbara" wrote in message @microsoft.com...
> >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
>
Back to top
View user's profile Send private message
Sue Mosher [MVP-Outlook]



Joined: 12 Aug 2007
Posts: 656

PostPosted: Fri Jan 18, 2008 7:07 pm    Post subject: Re: VBA code to put standard string into body of exisiting t Reply with quote

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


"Barbara" wrote in message @microsoft.com...
> 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.
>
> "Sue Mosher [MVP-Outlook]" wrote:
>
>> 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

>>
>> "Barbara" wrote in message @microsoft.com...
>> >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
>>

Back to top
View user's profile Send private message
Display posts from previous:   
Related Topics:
printing custom forms with user defined and standard fields Help. I am so proud of myself because I have managed to create a custom form and print it out beautifully by inserting a VSB script and linking it to Word. The only problem is that all of my user-defined fields print correctly .. . but I can't get the T

Can this be done through VBA-code Hi, Is it possible to retract let's say a mail through VBA. In addition to that I have three options the usual ones; tasks, appointments and mail. I add a record in an Access database and automate through Outlook. Works like a charm (thanks Ken..). Now if

What am I forgetting in this code... Hi, Specs: WinXP - Outlook 2003 I'm calling the Outlook object model from Access. I need to send appointments based on a recordset. I have three records in the recordset which are all appointments. I should get three different appointments but i'm getting

Code Returning Half of the Values I am running code that exports data releated to unread messages in an inbox. What is puzzling me is that the code only returns half of the values that it is supposed to. For example, if I have 50 unread messages, it will export the data on the first 25 a

Evault custom form & preview pane code Hi all, I'm trying to write a custom form which allows users to perform some tasks before sending. My problem is however that because the form does stuff on startup, recipients get the preview pane active scripting error. We however also have Evault which
Post new topic   Reply to topic    msoutlook.org Forum Index -> Outlook Program VBA All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group