Great! Glad to hear it's working for you. Sometimes I just get into those
coding moments and it's encouraging to actually hear back from someone that
used it!
VBA was certainly a walk down memory lane... actually more like a dark
smelly alley! I hope my children live to see the day when Office uses .NET
as its automation model.
--
Josh Einstein
Einstein Technologies
Microsoft Tablet PC MVP
Tablet Enhancements for Outlook 2.0 - Try it free for 14 days
www.tabletoutlook.com
"dim4x4" wrote in message
ups.com...
Thank you, Josh!
I moved your code to the module and it works great! Also for my first
problem, I found a solution here
http://www.outlookcode.com/codedetail.aspx?id=616 and modified your
CreateTestItem as follows below. It does what I need to do, the only
minor thing is that it opens and closes an appointment which makes a
quick flicker on the screen, but I guess I can live with that. Thank
you and Ken for your help!
This is my macro (apart from other parts that put cursor where I want
it):
Sub NewCall()
Dim objExpl As Outlook.Explorer
Dim objFolder As Outlook.MAPIFolder
Dim objCB As Office.CommandBarButton
Dim objAppt As Outlook.AppointmentItem
Dim objApptCustom As Outlook.AppointmentItem
On Error Resume Next
Set objExpl = Application.ActiveExplorer
If Not objExpl Is Nothing Then
Set objFolder = objExpl.CurrentFolder
If objFolder.DefaultItemType = olAppointmentItem Then
Set objCB = objExpl.CommandBars.FindControl(, 1106)
If Not objCB Is Nothing Then
objCB.Execute
Set objAppt = Application.ActiveInspector.CurrentItem
Set objApptCustom =
objFolder.Items.Add("IPM.Appointment.your_custom_c lass")
With objApptCustom
.Subject = DEFAULT_SUBJECT
.Start = objAppt.Start
.End = objAppt.End
.Duration = 5
.ReminderMinutesBeforeStart = 0
.Display
End With
End If
End If
End If
objAppt.Close olDiscard
Set objCB = Nothing
Set objAppt = Nothing
Set objApptCustom = Nothing
Set objFolder = Nothing
Set objExpl = Nothing
'SetBodyCursorPos 5
SetTextBoxCursorPos DEFAULT_SUBJECT, 5
End Sub