Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 627
  • Last Modified:

Changing macro to run custom form

Hello,

I've modified the existing task form to add two additional fields.  How may I alter the code below so that the code will open this form vs. the default task form.  I've modified the Task folder so that if I press the "New Task" button opens my modified task form by default.

I've attached the form (changed extension to .txt, other wise could not upload)

Thanks,
Dusty

Sub DeferIt()

Dim currentOLApp As Outlook.Application
Dim objNameSpace As NameSpace
Dim prpCategories As categories
Dim mthCategory As Category
Dim strActionTitle As String
Dim strErrMsg As String
Dim newTask As Outlook.TaskItem
Dim oMail As Outlook.MailItem

Set currentOLApp = CreateObject("Outlook.Application")
Set currentNameSpace = currentOLApp.GetNamespace("MAPI")

'frmMain.Show vbModal
'strProjectTitle = InputBox("Enter Project Name")
strActionTitle = InputBox("Enter Next Action")

CreateTask:
' Something needs to be selected
    If ExplorerHasSelectedItems() Then
        Dim selectedItem As Object
       
        Set selectedItem = Outlook.Application.ActiveExplorer.Selection.item(1)
                 
        Set newTask = currentOLApp.CreateItem(olTaskItem)
       
        newTask.subject = strActionTitle
        'newTask.subject = GetSubjectFromItem(selectedItem)
        newTask.body = GetItemAsText(selectedItem)
       
        ' Add the item as an attachment
        ' Remove for Outlook 2010.
        newTask.Attachments.Add selectedItem
       
        FileIt
         
        ' Now we can do the task editing.
        newTask.Display
        'newTask.categories = mthCategory
        newTask.ShowCategoriesDialog
         
    Else
   
        strNoSlct = MsgBox("You must select an item to create an action", vbCritical)
           
    End If

End Sub Modified-task-form.txt
0
dustywork
Asked:
dustywork
  • 2
1 Solution
 
David LeeCommented:
Hi, Dusty.

Change this line

    Set newTask = currentOLApp.CreateItem(olTaskItem)

to

    Set newTask = Session.GetDefaultFolder(olFolderTasks).Items.Add("IPM.Task.Tasks (Modified)")
0
 
dustyworkAuthor Commented:
Thanks!  Sorry for the slow response.  Overwhelmed at work...
0
 
David LeeCommented:
You're welcome.  No problem.  
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now