Calendar Macro

Status
Not open for further replies.

LMS

Senior Member
Outlook version
Email Account
Exchange Server
In the past you gave me this great macro that creates a e-mail to the contact I run it from based on a e-mail template. So is there a macro that using a contact again, will create an appointment with that contact not to the Outlook default calendar, but to a calendar that is a sub-folder of the default calendar from Outlook. Here is the macro just in case it would be easy to simply adjust this one. Thanks much and look forward to hearing back re this the other post. Public Sub MacroName

Set oContact = GetCurrentItem()

Dim objMsg As MailItem

' Blank message

' Set objMsg = Application.CreateItem(olMailItem)

' Use a template

Set objMsg = Application.CreateItemFromTemplate("C:\Users\UserName\AppData\Roaming\Microsoft\Templates\TemplateName.oft")
objMsg.To = oContact.Email1Address
'displays the message form so you can enter more text
objMsg.Display
'use this to send to outbox
'objMsg.Send
Set objMsg = Nothing

End Sub
 
So please tell me the full macro that I use and as to what you wrote, what words do I change re the name of the subfolder calendar I created.....thanks very very much.
 
Can you give me the full macro that I use and as to what you wrote, what words do I change re the name of the subfolder calendar I created....before you take your vacation??


 
I'll try to make time to do it before vacation and my business trip, but I'm not sure if i will - i have a lot of stuff to catch up on.
 
Thanks much. It's just the macro that when I open or identify a contact, run the macro and it creates a calendar event to my subofolder calendar the name of which is "Office Calendar" and it adds to the Subject line of the calendar event the full name of the contact and if possible, puts the contact link at the bottom.

Thanks again so much!
 
I came with the following code that is put in the ThisOutlookSession areas of the VBA.....is then is a marco, I created a shortcut to it in the contact form, and when I click on it in the contact form, it opens it up as an appointment in the subfolder calendar I use called "Office Calendar" . This comes from createing a new appointment in the calendar I want to use, and then published it with the name "Office Calendar Event".

So is there someting to add so that from the contact I click on it, it automatically puts in the link to the contact at link contact area at the bottom of the appointment.

Sub Office_Calendar_Event()
Set myFolder = Session.GetDefaultFolder(olFolderCalendar).Folders("Office Calendar")
Set myItem = myFolder.Items.Add("IPM.Appointment.Office Calendar Event")
myItem.Display

End Sub
 
That would be the links collection. http://msdn.microsoft.com/en-us/library/office/ff868983(v=office.14).aspx has info on it.

you'd need just this part i think, since you are getting the name from the contact. You'll need to pick the contact like you do in the email macro.

myitem.Links.Add oContact.fullname

something like this should work -

Sub Office_Calendar_Event()
Set oContact = GetCurrentItem()
Set myFolder = Session.GetDefaultFolder(olFolderCalendar).Folders ("Office Calendar")
Set myItem = myFolder.Items.Add("IPM.Appointment.Office Calendar Event")
myitem.Links.Add oContact.fullname
myItem.Display
End Sub
 
Thanks very much....but it did not add the link of the contact to the contact folder at the bottom of the appointment....'

Any other thoughts please?
 
Any error message? I can't test it because Links collection is only supported in 2010 and older and I don't have the older versions handy right now.
 
I just used your code again....and made sure it was what you gave me: here is it is, and the error is "Ambiguous name detected: GetCurrrentItem

Here is the code and there anything to try to fix please:

Sub Office_Calendar_Event()
Set oContact = GetCurrentItem()
Set myFolder = Session.GetDefaultFolder(olFolderCalendar).Folders("Office Calendar")
Set myItem = myFolder.Items.Add("IPM.Appointment.Office Calendar Event")

myItem.Links.Add oContact.FullName
myItem.Display
End Sub
 
Do you have the GetCurrentItem function? Does you have more than one copy of it? You only need each function in once- all of the macros that need it can share it.
 
Thanks. Where do i figure out if there is a GetCurrentItem function?

And if so, do i just take it out of this code please?
 
Press Ctrl+F to open the Find dialog. Select the option to search the project, then search for GetCurrentItem - you need 1 function. If you remove it from this macro, you'll need to tweak the code to work for either open items or selected items, but not both.

work-with-open-item-or-select-item
 
GetCurrentItem is in other macros......that link you mentioned gives the opportunity to use the macro with both open or selected items, so if that's the case, what specifically do I change the code you updated for me which is fhe following and if you can, please type the specifices that I simple copy and paste to the code or as the code, as i don't have the background of just understanding a concept.

Thanks as usual!!!

Sub Office_Calendar_Event()
Set oContact = GetCurrentItem()
Set myFolder = Session.GetDefaultFolder(olFolderCalendar).Folders ("Office Calendar")
Set myItem = myFolder.Items.Add("IPM.Appointment.Office Calendar Event")

myItem.Links.Add oContact.FullName
myItem.Display
End Sub
 
And if it can only be either from opening the contact or selecting the contact, I would the changes to the code so it works when i do it from opening the contact.

So just need the full code to paste. Thanks much!!
 
You only need 1 getcurrentitem function in the entire project files. The easiest fix is to delete all but one instance of it. I usually create 1 module named Functions and put all of the functions in it. Any macro that needs one of the functions can use them.
 
You won't get it tonight :) I'm on vacation and just trying to get a few things answered tonight since my helpers aren't very good helpers. I'd fire them, but that's hard to do since I'm not paying them. ;)
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
G Creating Macro to scrape emails from calendar invite body Outlook VBA and Custom Forms 6
J Macro to Insert a Calendar Outlook VBA and Custom Forms 8
U Macro for reminders,tasks,calendar Outlook VBA and Custom Forms 4
E Help with macro to answer and delete calendar requests? Outlook VBA and Custom Forms 5
W Add to Calendar links - auto accept with macro Using Outlook 1
N How Can I create an Outlook Macro to import calendar? Outlook VBA and Custom Forms 1
Fozzie Bear Calendar Events created on iPhone have suddenly start sending invitations to attendees Using Outlook 2
J Set calendar default to 'none' (policy) Exchange Server Administration 3
J Calendar events created on iPhone automatically changing default alert from 'None' to 'Time of Event' Using Outlook.com accounts in Outlook 0
G Outlook 365 My iCloud Outlook doesn’t work after reinstalling Microsoft365 on Windows 10 PC – now I get error message on contacts and calendar Using Outlook 1
U When opening shared Calendar "The set of folders cannot be opened" Using Outlook 0
P Can no longer sync Outlook with iPhone calendar after iPhone update to 17.1.1 Using Outlook 7
P turn off the default "all day" check box in new calendar items. How? Using Outlook 1
A Outlook 365 New Appointments All saved to a 365 default calendar on Mac Using Outlook 0
V Unchecking my calendar and leaving shared one visible Outlook VBA and Custom Forms 1
V VBA Categories unrelated to visible calendar and Visual appointment Categories Outlook VBA and Custom Forms 2
M New Calendar Appointments: Conditionally turn off reminder and show time as free Using Outlook 5
J Cannot edit a calendar event received as an invitation Using Outlook 2
H Outlook 365 O365 outlook calendar item editing Using Outlook 1
Kika Melo Outlook Calendar deleted appointments not in Deleted Items folder Using Outlook 3
P Copying ALL calendar entries from Calender in PST file to IMAP OST file? Using Outlook 1
e_a_g_l_e_p_i Question about calendar Using Outlook 5
icacream Outlook 2021 - Google calendar in the peek Using Outlook 0
e_a_g_l_e_p_i MY Outlook 2021 changed the format of the shortcuts for mail, calendar etc. Using Outlook 10
Fozzie Bear Shared Calendar For Scheduled Tasks Using Outlook.com accounts in Outlook 3
K Add an entry to a specific calendar Using Outlook 1
F Add a category before "Send an Email When You Add an Appointment to Your Calendar" Outlook VBA and Custom Forms 0
L Synch Outlook 365 calendar with iPhone Using Outlook 0
C Recover calendar Using Outlook 0
R How to prevent corrupted Notes format in Calendar and Contacts Using Outlook 0
L Duplicate calendar entries in Outlook 365 Using Outlook 3
G Stop Outlook 365 adding meetings to calendar Using Outlook 1
CWM550 Outlook 365 HELP! Calendar Craziness! Using Outlook 5
J Event/Meeting in Outlook Does Not Align with SharePoint Calendar Using Outlook 5
Commodore Slow calendar Using Outlook 0
C How to import Outlook calendar? Using Outlook 1
G Add contacts birthday to calendar Using Outlook 4
e_a_g_l_e_p_i Outlook 2021 all appointments not showing in calendar Using Outlook 2
V iCloud calendar problems, Outlook shuts down immediately Using Outlook 2
KeithJB iCloud calendar sync only works one way! Using Outlook 3
V Backup Calendar, Contacts, Tasks in an POP3 data file Using Outlook 3
O Unable to make changes to an existing Calendar entry Using Outlook 11
J VBA for outlook to compare and sync between calendar Outlook VBA and Custom Forms 1
A Meeting organizer calendar intermittently drops meeting after delegate sends invite Using Outlook 0
A Meeting organizer calendar intermittently drops meeting after delegate sends invite Exchange Server Administration 0
T Outlook 2010 Cannot edit Calendar entries in OL 2010. Using Outlook 1
M On behalf of not showing on calendar for boss Using Outlook 1
C Outlook 2016 Unable to delete Gmail IMAP calendar Using Outlook 2
A force outlook to default to MY calendar Using Outlook 3
O Carriage Return - Line Feeds - exporting Calendar events Using Outlook 0

Similar threads

Back
Top