Outlook code question: How to add "highlight subject line of task/select all" to code?

I just received a solution (http://www.experts-exchange.com/Software/Office_Productivity/Groupware/Outlook/Q_25477830.html#a28345637) to turn an Outlook message into a task with some code).  I use a keyboard shortcut to launch a command based on a macro that generates a task from an email.

***I'd like the subject line to be highlighted/"select all"ed so that I can change the subject line easily without having to select all ever y time.

The code I'm using is attached.

Public Sub AddToTasks()

  Dim olTask As Outlook.TaskItem

  Dim olMail As MailItem

  Dim olIns As Inspector

  Dim olExp As Explorer

  Set olTask = Application.CreateItem(olTaskItem)

  Set olExp = Application.ActiveExplorer

  If olExp.CurrentView <> "Messages" Then Exit Sub

  If olExp.Selection.Count <> 1 Then Exit Sub

  Set olMail = olExp.Selection.Item(1)

  With olTask

    .Subject = olMail.Subject

    .Body = olMail.Body

    .StartDate = Now

    .DueDate = DateAdd("d", 7 - Format$(Date, "w", vbSaturday), Date)

    .ReminderSet = False

  olTask.Status = olTaskInProgress

  End With

  Set olIns = olTask.GetInspector

  olIns.Display ("True")

End Sub

Open in new window

timmer79Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chris BottomleySoftware Quality Lead EngineerCommented:
If you always want to start from a blank line then set it blank, otherwise i'm not sure it's possible:

Chris
Public Sub AddToTasks()

  Dim olTask As Outlook.TaskItem

  Dim olMail As MailItem

  Dim olIns As Inspector

  Dim olExp As Explorer

  Set olTask = Application.CreateItem(olTaskItem)

  Set olExp = Application.ActiveExplorer

  If olExp.CurrentView <> "Messages" Then Exit Sub

  If olExp.Selection.count <> 1 Then Exit Sub

  Set olMail = olExp.Selection.Item(1)

  With olTask

    .Subject = ""

    .body = olMail.body

    .StartDate = Now

    .DueDate = DateAdd("d", 7 - Format$(Date, "w", vbSaturday), Date)

    .ReminderSet = False

  olTask.Status = olTaskInProgress

  End With

  Set olIns = olTask.GetInspector

  olIns.Display ("True")
End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
timmer79Author Commented:
Hmmm... I'm not sure that'd be better.  I'll wait and see if anyone has any ideas.  I guess you're saying keystrokes (or the equivalent) can't be added to code (Ctrl+A)...
0
Chris BottomleySoftware Quality Lead EngineerCommented:
I've just repeated my earlier attempts with sendkeys with no success so in the abscence of any other input I stand by my earlier belief that it cannot be done.

Chris
0
Chris BottomleySoftware Quality Lead EngineerCommented:
As per EE, (http://www.experts-exchange.com/help.jsp#hs=29&hi=405) "The correct answer to some questions is "You can't do that."

I suggest that is the maxim that applies in this case.

Chris
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.