Ade F
Avid Listener
- Local time
- Today, 11:45
- Joined
- Jun 12, 2003
- Messages
- 97
Firstly thanks to all the hard working people on here helping others. This forum has been the source for problem solving quite a few times.
This is driving me up the wall now and it's probably wood form the trees but here goes.
I have a folder under the default on in outlook named ANOTHER FOLDER. All I am trying to do is add the blasted entry to this folder. At the moment though it is adding the information to the default calendar and not ANOTHER FOLDER. I'm just testing at the moment but I have tried all manner of combination but no dice.
Can anyone please shed any light on what I am doing wrong here.:banghead:
This is driving me up the wall now and it's probably wood form the trees but here goes.
I have a folder under the default on in outlook named ANOTHER FOLDER. All I am trying to do is add the blasted entry to this folder. At the moment though it is adding the information to the default calendar and not ANOTHER FOLDER. I'm just testing at the moment but I have tried all manner of combination but no dice.
Code:
'Error 429 occurs with GetObject if Outlook is not running.
On Error Resume Next
Set objOutlook = GetObject(, "Outlook.Application")
If Err.Number = 429 Then 'Outlook is NOT running.
MsgBox "Outlook is not running please start and wait for it to completely load then press this button again.", vbCritical, "Whoops Outlook isn't running"
Else
MsgBox "You have just updated the outlook calendar. ", vbInformation, Title:="Outlook Calendar Updated"
Dim olApp As Outlook.Application
Dim olNS As Outlook.NameSpace
Dim olFolder As Outlook.Folder
Dim olAppt As Outlook.AppointmentItem
Set olApp = CreateObject("Outlook.Application")
Set olNS = olApp.GetNamespace("MAPI")
Set olFolder = olNS.GetDefaultFolder("ANOTHER CALENDAR")
Set olAppt = olApp.CreateItem(olAppointmentItem)
olAppt.Start = Me.DateOfJob
olAppt.subject = Me.Job_ID
olAppt.Location = "Test"
olAppt.Body = "Test"
olAppt.ReminderSet = True
'Set reminder for 1 day before.
olAppt.ReminderMinutesBeforeStart = 1440
olAppt.AllDayEvent = True
olAppt.Save
Set olAppt = Nothing
Set olFolder = Nothing
Set olNS = Nothing
Set olApp = Nothing
End If
Can anyone please shed any light on what I am doing wrong here.:banghead: