Calendar Macro

Status
Not open for further replies.

LMS

Senior Member
Outlook version
Outlook 2007
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
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
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.
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
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??


 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
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.
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
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!
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Any update by any chance?
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
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
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
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
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
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?
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
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.
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
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
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
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.
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
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?
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
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
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
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
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
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!!
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
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.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
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.
Thread starter Similar threads Forum Replies Date
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
M In Outlook Calendar remove the buttons: 'Today' and '<' (Back a day) and '>' (Forward a day) that are below the Ribbon and above the calendar display. Using Outlook 0
O Calendar - appointment templates and categories Using Outlook 1
HarvMan Outlook 365 Calendar Using Outlook 12
A calendar invites sent from Microsoft Outlook to Mac Outlook is not working Calendar Printing Assistant 2
P Categorize in Calendar not listed under tags in Office 365 (Office 2016) Using Outlook 5
O Export Outlook calendar appointments by filters and date range Outlook VBA and Custom Forms 1
J Weekend View in Calendar Using Outlook 1
D Add date next to day name in Outlook Today calendar view Using Outlook 1
A Birthdays from .csv to Calendar - arriving day behind Using Outlook 5
C Put Day of Year into Outlook Calendar Outlook VBA and Custom Forms 2
J can't sync outlook calendar contacts with iphone ipad Using Outlook 4
C Outlook Calendar Using Outlook 1
L Deleting Office 365 calendar appt w/o emailing invitees Using Outlook 3
sahameed82 SharePoint calendar directly open in Outlook Using Outlook 0
D Outlook 2016 Migrate 'On My Computer' (local storage) Calendar from Mac Outlook to Exchange Account Using Outlook 5
TomHuckstep Outlook 2016 Limit the number of days syncing from Google Calendar Using Outlook 1
J Outlook 2010 Changing events in Outlook calendar via opening file, importing CSV Using Outlook 0
Jennifer Murphy Add birthdays to calendar Using Outlook 7
M Creating an RSS Feed **FROM** Outlook 2013 Calendar. Using Outlook 5
K Accentuating today in Outlook calendar month view Using Outlook 2
S outlook 2007 calendar search Using Outlook 6
V iCloud calendar sync problems Using Outlook 13
J Copy to calendar function no longer working in outlook 365 Using Outlook 5
T why are the calendar icons different for different accounts Using Outlook 2
D Can Exchange Admin Center create a pst for users email/contacts/calendar? Exchange Server Administration 0
P OWA Settings->Calendar->Events from Email; Setting changes do not hold Using Outlook 1
W Outlook Calendar does not save view any longer! Using Outlook 3
M move to iCloud not working in outlook calendar Using Outlook 12
C Shading every other week on monthly calendar Using Outlook 4
cricket1001 Problems with calendar syncing Using Outlook 0
cricket1001 Shade non-working days in calendar Using Outlook 0
F My hotmail calendar is not syncing with my outlook but my email is Using Outlook 3
M Where is the setting to *turn off* open calendar in a new window? Using Outlook 3
T Outlook 2010 Advice on syncing OL2010 Calendar and Outlook app Using Outlook 0
M Custom Calendar Print Suggestions? Using Outlook 0
L Time format in Outlook calendar and emails Using Outlook 0
GregS Simple calendar sharing doesn't work Using Outlook 6
P Strange Calendar Entries Using Outlook 4
W Looks like the folder below has been deleted: "iCloud\Calendar" Using Outlook 1
T "cannot find the calendar folder for this item" - calendar items stuck in outbox Using Outlook 0
P How can I change my calendar view back Using Outlook 3
N Gathering Calendar Appointments from Calendars that synced as Contacts Exchange Server Administration 1
S Conditional Formatting in calendar part of To-Do Bar Using Outlook 1
S Outlook 2007 Calendar instant search problem. Windows 7 Using Outlook 4
S Outlook 2007 Calendar instant search problem. Windows 7 Using Outlook 0
A Auto Accept Meetings from the General Calendar Using Outlook 3
Similar threads


















































Top