Link to home
Start Free TrialLog in
Avatar of dustywork
dustywork

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of David Lee
David Lee
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dustywork
dustywork

ASKER

Thanks!  Sorry for the slow response.  Overwhelmed at work...
You're welcome.  No problem.