M
msrado
Hello all,
I've created an Outlook add-in using Visual Basic 6 that contains a
class module that can be called by a VB EXE. The class module contains
a routine to create an appointment in Outlook and save it. The EXE
accesses the routine by creating an instance of Outlook with
CreateObject (invisible) and pulling out a reference to the class.
Then it creates the appointment by filling the properties of a new
AppointmentItem object and using the Save method.
The problem is that the appointment doesn't show up in Outlook until a
new appointment is set with a visible version of Outlook. The visible
version of Outlook is created by having the user start Outlook before
the EXE runs or by using the OpenProcess function to open Outlook.
Does anybody know whats going on? I've tried always using OpenProcess
to start Outlook before my EXE gets to the appointment part, but
Outlook always appears maximized with focus and covers my app. Can I
start Outlook through my EXE as a minimized app without focus?
My code for the EXE is :
Dim objOL As Object 'object to text for Outlook
Dim clsAppt as Object 'class to set appointment
'test for outlook
Set objOL = GetObject(, "Outlook.Application")
If objOL Is Nothing Or Err.Number <> 0 Then
Err.Clear
Set objOL = CreateObject("Outlook.Application")
End If
'attach to the class
Set objAddin = objOL.COMAddIns.Item("MyAddIn.Connect").object
If Not (objAddin Is Nothing) Then
Set clsAppt = objAddin.clsAppt
Else
GoTo Trap_Error
End If
Exit Sub
My code in the class is: (objOutlook is created and initialized to the
Outlook Application when the add-in is started)
Dim objAppt As Object 'appointment
On Error GoTo Add_Err
Set objAppt = objOutlook.CreateItem(olAppointmentItem)
With objAppt
.Start = dtStartTime
.End = dtEndTime
.Subject = sSubject
.Location = sLocation
.Body = sBody
.ReminderSet = True
.MeetingStatus = olNonMeeting
.Save
.Close (olSave)
End With
'Release the object variables
Set objAppt = Nothing
I appreciate any help! My app would be super cool if I could figure
this out!
Thanks,
Robin
I've created an Outlook add-in using Visual Basic 6 that contains a
class module that can be called by a VB EXE. The class module contains
a routine to create an appointment in Outlook and save it. The EXE
accesses the routine by creating an instance of Outlook with
CreateObject (invisible) and pulling out a reference to the class.
Then it creates the appointment by filling the properties of a new
AppointmentItem object and using the Save method.
The problem is that the appointment doesn't show up in Outlook until a
new appointment is set with a visible version of Outlook. The visible
version of Outlook is created by having the user start Outlook before
the EXE runs or by using the OpenProcess function to open Outlook.
Does anybody know whats going on? I've tried always using OpenProcess
to start Outlook before my EXE gets to the appointment part, but
Outlook always appears maximized with focus and covers my app. Can I
start Outlook through my EXE as a minimized app without focus?
My code for the EXE is :
Dim objOL As Object 'object to text for Outlook
Dim clsAppt as Object 'class to set appointment
'test for outlook
Set objOL = GetObject(, "Outlook.Application")
If objOL Is Nothing Or Err.Number <> 0 Then
Err.Clear
Set objOL = CreateObject("Outlook.Application")
End If
'attach to the class
Set objAddin = objOL.COMAddIns.Item("MyAddIn.Connect").object
If Not (objAddin Is Nothing) Then
Set clsAppt = objAddin.clsAppt
Else
GoTo Trap_Error
End If
Exit Sub
My code in the class is: (objOutlook is created and initialized to the
Outlook Application when the add-in is started)
Dim objAppt As Object 'appointment
On Error GoTo Add_Err
Set objAppt = objOutlook.CreateItem(olAppointmentItem)
With objAppt
.Start = dtStartTime
.End = dtEndTime
.Subject = sSubject
.Location = sLocation
.Body = sBody
.ReminderSet = True
.MeetingStatus = olNonMeeting
.Save
.Close (olSave)
End With
'Release the object variables
Set objAppt = Nothing
I appreciate any help! My app would be super cool if I could figure
this out!
Thanks,
Robin