Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Changing macro to run custom form

Posted on 2011-03-21
3
Medium Priority
?
625 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 1000 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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

This article will help to fix the below error for MS Exchange server 2010 I. Out Of office not working II. Certificate error "name on the security certificate is invalid or does not match the name of the site" III. Make Internal URLs and External…
Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
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…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

670 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