Solved

Changing macro to run custom form

Posted on 2011-03-21
3
616 Views
Last Modified: 2012-05-11
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
Comment
Question by:dustywork
  • 2
3 Comments
 
LVL 76

Accepted Solution

by:
David Lee earned 250 total points
Comment Utility
Hi, Dusty.

Change this line

    Set newTask = currentOLApp.CreateItem(olTaskItem)

to

    Set newTask = Session.GetDefaultFolder(olFolderTasks).Items.Add("IPM.Task.Tasks (Modified)")
0
 

Author Closing Comment

by:dustywork
Comment Utility
Thanks!  Sorry for the slow response.  Overwhelmed at work...
0
 
LVL 76

Expert Comment

by:David Lee
Comment Utility
You're welcome.  No problem.  
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

We are happy to announce a brand new addition to our line of acclaimed email signature management products – CodeTwo Email Signatures for Office 365.
Follow this checklist to learn more about the 15 things you should never include in an email signature from personal quotes, animated gifs and out-of-date marketing content.
The purpose of this video is to demonstrate how to set up Lists in Mailchimp. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchimp account. : Click on Lists. Click on Create List Button : Choose the desi…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now