|
-
Oct 3rd, 2000, 05:04 AM
#1
Thread Starter
New Member
I'm trying to enter an appiontment into Outlook, for the default user, with the following code -
Public Sub gnlAddBirthday(ByVal strKidsName, ByVal dteBirthday)
Dim olAppt As outlook.AppointmentItem
Dim strDate As String
Dim strYear As String
Dim strBDate As String
Dim strBRest As String
Dim strBirthday As String
Dim winHwnd As Long
Dim boolOpened As Boolean
boolOpened = False
Screen.MousePointer = vbHourglass
Set olApp = New outlook.Application
Set olNameSpace = olApp.GetNamespace("MAPI")
olNameSpace.Logoff
olNameSpace.Logon
Set olRecipient = olNameSpace.CreateRecipient(olNameSpace.CurrentUser.Name)
Set olAppt = olNameSpace.GetSharedDefaultFolder(olRecipient, olFolderCalendar).Items.Add
With olAppt
.Subject = strKidsName + "'s Birthday"
.Body = "It's " + strKidsName + "'s Birthday today"
strDate = CDate(Date)
strYear = Right(strDate, 2)
strBDate = CDate(dteBirthday)
strBRest = Left(strBDate, 6)
strBirthday = strBRest + strYear
.Start = CDate(strBirthday + " 08:00 AM")
.End = CDate(strBirthday + " 08:01 AM")
.ReminderMinutesBeforeStart = "15"
.ReminderPlaySound = True
.Save
End With
Set olAppt = Nothing
Screen.MousePointer = vbDefault
End Sub
Can somebody please tell me what is wrong with this!!
-
Oct 4th, 2000, 01:40 PM
#2
Addicted Member
What is it doing (or not doing) that is bad or unexpected? This will help us know where in your code to look.
-
Oct 5th, 2000, 03:18 AM
#3
Thread Starter
New Member
When it hits Set olAppt I get the following -
Run-time error - 1733165047(98b20009)
Outlook does not recognise one or more names!
-
Oct 5th, 2000, 11:35 AM
#4
Addicted Member
I copied your code into a new form, added the objects it needed to execute, and added a birthday reminder. It worked both with and without Outlook running. The error message indicates that your createrecipient statement didn't work. Check your error code at that point. Does the machine that is running this have Outlook installed and a default user assigned? If not, Outlook needs to be installed, and either your logon needs to have a user and password, or you need a default Outlook user.
-
Oct 9th, 2000, 03:46 AM
#5
Thread Starter
New Member
I have Outlook installed, and there is only one account, which automatically is the default. Is there any way to get round the Username, Password entry??
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|