Hi everyone. I'm trying to create a new task item based on a custom form, which will be executed by a button in that form. The custom form folder is in a public folder.
For now I have the following code in my custom form:
That works as long as I'm in that public folder. But if I go into the inbox to - for example - copy something from a mail into the form, then the inbox suddenly becomes the current folder, so then the code creates a mail item instead of a task item based on the form, unless I actively go back into the public folder by selecting it.
So my question is: How can I make Outlook create a new task item without using the CurrentFolder method? The public folder is in this location: All Public Folders\Sites\Romeo\Production\BIS\Booking\BookingForm.
I'm guessing it involves using GetDefaultFolder, but I'm not sure how to put it all together.
Thanks!
For now I have the following code in my custom form:
Code:
Sub cmdKorrFart_Click()
Dim myFolder, myTask
Set myFolder = Application.ActiveExplorer.CurrentFolder
Set myTask = myFolder.Items.Add
myTask.Display
End Sub
That works as long as I'm in that public folder. But if I go into the inbox to - for example - copy something from a mail into the form, then the inbox suddenly becomes the current folder, so then the code creates a mail item instead of a task item based on the form, unless I actively go back into the public folder by selecting it.
So my question is: How can I make Outlook create a new task item without using the CurrentFolder method? The public folder is in this location: All Public Folders\Sites\Romeo\Production\BIS\Booking\BookingForm.
I'm guessing it involves using GetDefaultFolder, but I'm not sure how to put it all together.
Thanks!