Solved

Changing macro to run custom form

Posted on 2011-03-21
3
623 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 76

Accepted Solution

by:
David Lee earned 250 total points
ID: 35193708
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
ID: 35329079
Thanks!  Sorry for the slow response.  Overwhelmed at work...
0
 
LVL 76

Expert Comment

by:David Lee
ID: 35329257
You're welcome.  No problem.  
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is my first article on Expert Exchange on the Manual Method of Exporting Office 365 Mailboxes to PST format by using the eDiscovery mechanism of Office. Hope you will enjoy the article.
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
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, f…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

734 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