nhorton79
Registered User.
- Local time
- Tomorrow, 04:41
- Joined
- Aug 17, 2015
- Messages
- 147
Hi All,
I am wanting to setup appointments in my Access database, and then have those appointment populate to Outlook 365.
I have setup the table (tblAppointments) with the necessary fields and have created a form to handle these (frmAppointments).
I have some VBA code which is mostly working perfectly, the only issue I have it getting it to send the body of the appointment.
On my save&close button (btnSavenClose) I have this sub procedure:
I originally set this to .Body = ...., but it originally included <div> tags on the body text when the appointment was created. Once I changed it to .RTFBody I now get: Runtime error 6 Overflow and when I click Debug it highlights the .RTFBody line.
The field and the textbox are both currently set to Rich Text, and I have tried this with the table field set to plain text also.
I also tried declaring a variable as a byte and then setting this to my field:
Then further down in the with statement, setting RTFBody to the byte variable:
Still nothing...:banghead:
I want my team to be able to add signatures and formatted text to their appointments, especially for when they send them out to clients.
Please help. I have searched and searched and searched on this one, and feel like I'm so close....to getting there....or losing my mind.
I am wanting to setup appointments in my Access database, and then have those appointment populate to Outlook 365.
I have setup the table (tblAppointments) with the necessary fields and have created a form to handle these (frmAppointments).
I have some VBA code which is mostly working perfectly, the only issue I have it getting it to send the body of the appointment.
On my save&close button (btnSavenClose) I have this sub procedure:
Code:
Private Sub btnSavenClose_Click()
Dim oOutlook As Object
Dim sAPPPath As String
If IsAppRunning("Outlook.Application") = True Then 'Outlook was already running
Set oOutlook = GetObject(, "Outlook.Application") 'Bind to existing instance of Outlook
Else 'Could not get instance of Outlook, so create a new one
sAPPPath = GetAppExePath("outlook.exe") 'determine outlook's installation path
Shell (sAPPPath) 'start outlook
Do While Not IsAppRunning("Outlook.Application")
DoEvents
Loop
Set oOutlook = GetObject(, "Outlook.Application") 'Bind to existing instance of Outlook
End If
Const olAppointmentItem = 1
Dim oOutlookAppt As Object
Set oOutlookAppt = oOutlook.CreateItem(olAppointmentItem) 'Start a new appointment
With oOutlookAppt
.RequiredAttendees = Nz(Me.txtApptAttendees, "")
.Subject = Nz(Me.txtApptSubject, "")
.Location = Nz(Me.txtApptLocation, "")
.Start = Me.txtApptStart
.End = Me.txtApptEnd
.Duration = Me.txtApptDurationMinutes
.AllDayEvent = Me.chkAllDayEvent
.Importance = Me.cboApptImportance
.BusyStatus = Me.cboApptShowTimeAs
.RTFBody = Nz(Me.txtApptNotes, "")
.Mileage = Me.txtApptID 'Store the appointment id in the mileage field for later reference, updates, deletion etc.
End With
oOutlookAppt.Save
MsgBox "Appointment Added!"
End Sub
The field and the textbox are both currently set to Rich Text, and I have tried this with the table field set to plain text also.
I also tried declaring a variable as a byte and then setting this to my field:
Code:
Dim b() As Byte
b = Nz(Me.txtApptNotes, "")
Code:
.RTFBody = b
I want my team to be able to add signatures and formatted text to their appointments, especially for when they send them out to clients.
Please help. I have searched and searched and searched on this one, and feel like I'm so close....to getting there....or losing my mind.