Macro keyboard shortcut not working

E

E. Thornton

I wrote a VB macro that will create a task in Outlook from the currently
selected task in Project. I am using 2003 versions of both applications.
Code is below, in case that is related to the problem.

It works fine when I run it from VB Editor, or when I run the macro from
Tools/Macros, but nothing happens when I use my assigned Ctrl+T shortcut. I
have macro security set to Low. Any idea how to fix this?

CODE:
Sub CreateTask()
' Macro to create Outlook tasks from selected Project tasks.

Const olTaskItem = 3
Dim T As Task
Dim TaskListMessage As String

Set objOutlook = CreateObject("Outlook.Application")

For Each T In ActiveSelection.Tasks
Set objTask = objOutlook.CreateItem(olTaskItem)
objTask.Subject = T.Name
objTask.ReminderSet = True
objTask.DueDate = T.Finish
objTask.Save

If TaskListMessage = "" Then
TaskListMessage = T.Name
Else
TaskListMessage = TaskListMessage & ", " & T.Name
End If
Next T

MsgBox "Tasks created: " & TaskListMessage ' Show confirmation

End Sub
 
J

JulieS

Hello E. Thornton,

The keyboard shortcut CTRL + T is already assign to the command
"Build Team from Enterprise". I was able to get your code to work
using other keyboard shortcuts that were not already assigned to an
existing command.

I hope this helps. Let us know how you get along.

Julie
Project MVP

Visit http://project.mvps.org/ for the FAQs and additional
information about Microsoft Project
 
E

E. Thornton

Thanks, Julie, that worked. For some reason, Project doesn't alert me that
CTRL+T is reserved, so this didn't occur to me. I changed it to CTRL+Q and
no problem. Thanks.
 
J

JulieS

You're welcome. I too was a bit surprised that there would not be a
visible alert that a keyboard shortcut was already reserved, but I'm
glad you worked it out with another shortcut.

Julie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top