(Msg. 1) Posted: Fri Oct 19, 2007 8:12 am
Post subject: Help! putting dates from access into PUBLIC calendar, Archived from groups: microsoft>public>outlook>program_vba (more info?)
at the moment i am exporting some dates into an appointment from access using
a command button which does this ---
Private Sub cmdAddAppt_Click()
On Error GoTo Add_Err
'Save record first to be sure required fields are filled.
DoCmd.RunCommand acCmdSaveRecord
'Exit the procedure if appointment has been added to Outlook.
Dim objOutlook As Outlook.Application
Dim objAppt As Outlook.AppointmentItem
Dim objRecurPattern As Outlook.RecurrencePattern
Set objOutlook = CreateObject("Outlook.Application")
Set objAppt = objOutlook.CreateItem(olAppointmentItem)
With objAppt
.Start = Me!Starthire
.Duration = Me!Days
.Subject = Me!JobNo
.end = Me!Endhire
If Not IsNull(Me!Text223) Then .Body = Me!Text223
If Not IsNull(Me!City) Then .Location = Me!City
.Save
.Close (olSave)
End With
'Release the AppointmentItem object variable.
Set objAppt = Nothing
'Release the object variables.
Set objOutlook = Nothing
Set objRecurPattern = Nothing
'Set the AddedToOutlook flag, save the record, display
'a message.
DoCmd.RunCommand acCmdSaveRecord
MsgBox "Appointment Added!"
Exit Sub
Add_Err:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description
Exit Sub
End Sub
However this puts it into the personal calendar and i need it to go into the
a public calendar...
I found this code that should work but i cant get them to work together...
Dim myFolder As Object
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myFolder = myNameSpace.Folders("Public Folders")
Set myFolder = myFolder.Folders("All Public Folders")
Set myFolder = myFolder.Folders("name of folder")
'If the folder is just below the All Public Folders location. If it is
'elsewhere you keep adding Folders references until you hit the folder
'you want.
Set myFolderItems = myFolder.Items
Set objAppt = myFolderItems.Add(olAppointmentItem)
' olAppointmentItem is standard outlook form. If using custom form it must
be published in Organizational Forms
Library.
Can someone help me put it together so they work??
(Msg. 2) Posted: Fri Oct 19, 2007 11:22 am
Post subject: Re: Help! putting dates from access into PUBLIC calendar, [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
Items.Add is the right method. You need no arguments if you're creating an appointment with the standard form. What specifically doesn't work for you with that approach?
"bilbo+" <bilbo RemoveThis @discussions.microsoft.com> wrote in message news:ECC8F18B-987F-4A4A-9FC7-59289EBA0816@microsoft.com...
>
> I found this code that should work but i cant get them to work together...
>
> Dim myFolder As Object
>
>
> Set myNameSpace = myOlApp.GetNamespace("MAPI")
>
> Set myFolder = myNameSpace.Folders("Public Folders")
> Set myFolder = myFolder.Folders("All Public Folders")
> Set myFolder = myFolder.Folders("name of folder")
> 'If the folder is just below the All Public Folders location. If it is
> 'elsewhere you keep adding Folders references until you hit the folder
> 'you want.
>
> Set myFolderItems = myFolder.Items
> Set objAppt = myFolderItems.Add(olAppointmentItem)
>
> ' olAppointmentItem is standard outlook form. If using custom form it must
> be published in Organizational Forms
> Library.
>
> Can someone help me put it together so they work??
(Msg. 3) Posted: Fri Oct 19, 2007 11:22 am
Post subject: Re: Help! putting dates from access into PUBLIC calendar, [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
I'#m not that proficient with VB code so ive been taking snippets and trying
to get them to work together, if i simply paste the scond load of code into
the first one then it doesnt work, i was wondering if someone would be able
to put them together so it works. if i put it all together it comes up with
an object error. If someone could put it together how it 'should' work then
im sure it will. Basically im guessing if i put them together it doesnt work
becauase its contradicting itself in the code? is that right? The folder im
after is in public folders > all public folders > cks diary
Am i making sense!?
Thanks
"Sue Mosher [MVP-Outlook]" wrote:
> Items.Add is the right method. You need no arguments if you're creating an appointment with the standard form. What specifically doesn't work for you with that approach?
>
> You didn't say where your target folder is located in the Public Folders hierarchy. You can either walk the folder hierarchy using the Folders collections or use a function that does that for you. See http://www.outlookcode.com/d/code/getfolder.htm and, especially for public folders, http://www.outlookcode.com/codedetail.aspx?id=1164 >
> --
> Sue Mosher, Outlook MVP
> Author of Microsoft Outlook 2007 Programming:
> Jumpstart for Power Users and Administrators
> http://www.outlookcode.com/article.aspx?id=54 >
>
> "bilbo+" <bilbo DeleteThis @discussions.microsoft.com> wrote in message news:ECC8F18B-987F-4A4A-9FC7-59289EBA0816@microsoft.com...
> >
> > I found this code that should work but i cant get them to work together...
> >
> > Dim myFolder As Object
> >
> >
> > Set myNameSpace = myOlApp.GetNamespace("MAPI")
> >
> > Set myFolder = myNameSpace.Folders("Public Folders")
> > Set myFolder = myFolder.Folders("All Public Folders")
> > Set myFolder = myFolder.Folders("name of folder")
> > 'If the folder is just below the All Public Folders location. If it is
> > 'elsewhere you keep adding Folders references until you hit the folder
> > 'you want.
> >
> > Set myFolderItems = myFolder.Items
> > Set objAppt = myFolderItems.Add(olAppointmentItem)
> >
> > ' olAppointmentItem is standard outlook form. If using custom form it must
> > be published in Organizational Forms
> > Library.
> >
> > Can someone help me put it together so they work??
>
>
(Msg. 4) Posted: Fri Oct 19, 2007 12:57 pm
Post subject: Re: Help! putting dates from access into PUBLIC calendar, [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
You have everything you need already in the code you originally posted. Basically, you need to:
a) Return a MAPIFolder object by walking the folder hierarchy.
b) Once you have that object, use its Items.Add method to add a new item to the folder.
Just put the correct name of the folder in the third Set myFolder = statement that you shared earlier.
Tip for next time: Explain exactly what code you are referring to rather than using vague terms like "second load of code." Remember no one here can look over your shoulder.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
"bilbo+" <bilbo.DeleteThis@discussions.microsoft.com> wrote in message news:9C694208-C607-4E6B-B607-1DF4696A0B1A@microsoft.com...
> I'#m not that proficient with VB code so ive been taking snippets and trying
> to get them to work together, if i simply paste the scond load of code into
> the first one then it doesnt work, i was wondering if someone would be able
> to put them together so it works. if i put it all together it comes up with
> an object error. If someone could put it together how it 'should' work then
> im sure it will. Basically im guessing if i put them together it doesnt work
> becauase its contradicting itself in the code? is that right? The folder im
> after is in public folders > all public folders > cks diary
>
> Am i making sense!?
> Thanks
>
> "Sue Mosher [MVP-Outlook]" wrote:
>
>> Items.Add is the right method. You need no arguments if you're creating an appointment with the standard form. What specifically doesn't work for you with that approach?
>>
>> You didn't say where your target folder is located in the Public Folders hierarchy. You can either walk the folder hierarchy using the Folders collections or use a function that does that for you. See http://www.outlookcode.com/d/code/getfolder.htm and, especially for public folders, http://www.outlookcode.com/codedetail.aspx?id=1164 >>
>> "bilbo+" <bilbo.DeleteThis@discussions.microsoft.com> wrote in message news:ECC8F18B-987F-4A4A-9FC7-59289EBA0816@microsoft.com...
>> >
>> > I found this code that should work but i cant get them to work together...
>> >
>> > Dim myFolder As Object
>> >
>> >
>> > Set myNameSpace = myOlApp.GetNamespace("MAPI")
>> >
>> > Set myFolder = myNameSpace.Folders("Public Folders")
>> > Set myFolder = myFolder.Folders("All Public Folders")
>> > Set myFolder = myFolder.Folders("name of folder")
>> > 'If the folder is just below the All Public Folders location. If it is
>> > 'elsewhere you keep adding Folders references until you hit the folder
>> > 'you want.
>> >
>> > Set myFolderItems = myFolder.Items
>> > Set objAppt = myFolderItems.Add(olAppointmentItem)
>> >
>> > ' olAppointmentItem is standard outlook form. If using custom form it must
>> > be published in Organizational Forms
>> > Library.
>> >
>> > Can someone help me put it together so they work??
>>
>>
All times are: Eastern Time (US & Canada) (change)
Page 1 of 1
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum