How to copy an appointment from a public calendar to personal cale

  • Thread starter Thread starter Tiger
  • Start date Start date
Status
Not open for further replies.
T

Tiger

Hi,

I have little experience with VBA. I have a script that i got from here

which allows me press a button that once pressed it would add the user that

pressed it to the list of required attendees to the existing event.

However i want it to also add the event that was pressed to send the

appointment to the personal calendar.

Bellow is the script that i am using. What and where should i add the

function that i need?

Thank you for you time.

Sub AddRecip()

Dim oAppt As Outlook.AppointmentItem

Dim colRecips As Outlook.Recipients

Dim oRecip As Outlook.Recipient

Set oAppt = Application.ActiveExplorer.Selection.Item(1)

Set colRecips = oAppt.Recipients

Set oRecip = colRecips.Add(Application.GetNamespace("MAPI").CurrentUser)

oRecip.Type = olTo

oAppt.Save

oAppt.Send

Set oRecip = Nothing

Set colRecips = Nothing

Set oAppt = Nothing

End Sub
 
Before you release the item just use its Copy() method to copy it wherever

you want.

"Tiger" <Tiger> wrote in message

news:9BC9DDC8-C545-4196-BB45-6197E189B0D3@microsoft.com...
> Hi,

> I have little experience with VBA. I have a script that i got from here
> which allows me press a button that once pressed it would add the user
> that
> pressed it to the list of required attendees to the existing event.

> However i want it to also add the event that was pressed to send the
> appointment to the personal calendar.

> Bellow is the script that i am using. What and where should i add the
> function that i need?

> Thank you for you time.

> Sub AddRecip()
> Dim oAppt As Outlook.AppointmentItem
> Dim colRecips As Outlook.Recipients
> Dim oRecip As Outlook.Recipient

> Set oAppt = Application.ActiveExplorer.Selection.Item(1)
> Set colRecips = oAppt.Recipients
> Set oRecip =
> colRecips.Add(Application.GetNamespace("MAPI").CurrentUser)
> oRecip.Type = olTo

> oAppt.Save
> oAppt.Send

> Set oRecip = Nothing
> Set colRecips = Nothing
> Set oAppt = Nothing
> End Sub

>
 
Re: How to copy an appointment from a public calendar to personal

Ken, Thanks for the help. Though i do have limited knowledge. I have done

this but it will not work can you show me and rectify my problem? I want it

to be copied in the standard personal calendar.

Thanks,

Sub AddRecip()

Dim oAppt As Outlook.AppointmentItem

Dim colRecips As Outlook.Recipients

Dim oRecip As Outlook.Recipient

Set oAppt = Application.ActiveExplorer.Selection.Item(1)

Set colRecips = oAppt.Recipients

Set oRecip = colRecips.Add(Application.GetNamespace("MAPI").CurrentUser)

oRecip.Type = olTo

oAppt.Save

oAppt.Copy ("Calendar")

oAppt.Send

Set oRecip = Nothing

Set colRecips = Nothing

Set oAppt = Nothing

End Sub
wrote:


> Before you release the item just use its Copy() method to copy it wherever
> you want.

> >

>

> "Tiger" <Tiger> wrote in message
> news:9BC9DDC8-C545-4196-BB45-6197E189B0D3@microsoft.com...
> > Hi,
> > I have little experience with VBA. I have a script that i got from here
> > which allows me press a button that once pressed it would add the user
> > that
> > pressed it to the list of required attendees to the existing event.
> > However i want it to also add the event that was pressed to send the
> > appointment to the personal calendar.
> > Bellow is the script that i am using. What and where should i add the
> > function that i need?
> > Thank you for you time.
> > Sub AddRecip()
> > Dim oAppt As Outlook.AppointmentItem
> > Dim colRecips As Outlook.Recipients
> > Dim oRecip As Outlook.Recipient
> > Set oAppt = Application.ActiveExplorer.Selection.Item(1)
> > Set colRecips = oAppt.Recipients
> > Set oRecip =
> > colRecips.Add(Application.GetNamespace("MAPI").CurrentUser)
> > oRecip.Type = olTo
> > oAppt.Save
> > oAppt.Send
> > Set oRecip = Nothing
> > Set colRecips = Nothing
> > Set oAppt = Nothing
> > End Sub
> >


>
 
Re: How to copy an appointment from a public calendar to personal

If you look at the Object Browser for AppointmentItem.Copy() you will see

that it returns an object (a function) and that it accepts no arguments.

Take the return value as another AppointmentItem and then call Move() on

that item using the calendar MAPIFolder object as the argument.

Dim oNewAppt As Outlook.AppointmentItem

Dim oMoved As Outlook.AppointmentItem

Dim oNS As Outlook.NameSpace

Dim oFolder As Outlook.MAPIFolder

Set oNS = Application.GetNameSpace("MAPI")

Set oFolder = oNS.GetDefaultFolder(olFolderCalendar)

' other code

Set oNewAppt = oAppt.Copy()

oNewAppt.Save

Set oMoved = oNewAppt.Move(oFolder)

"Tiger" <Tiger> wrote in message

news:CE751403-8004-4C8A-A600-65E6128A9754@microsoft.com...
> Ken, Thanks for the help. Though i do have limited knowledge. I have done
> this but it will not work can you show me and rectify my problem? I want
> it
> to be copied in the standard personal calendar.

> Thanks,

> Sub AddRecip()
> Dim oAppt As Outlook.AppointmentItem
> Dim colRecips As Outlook.Recipients
> Dim oRecip As Outlook.Recipient

> Set oAppt = Application.ActiveExplorer.Selection.Item(1)
> Set colRecips = oAppt.Recipients
> Set oRecip =
> colRecips.Add(Application.GetNamespace("MAPI").CurrentUser)
> oRecip.Type = olTo

> oAppt.Save
> oAppt.Copy ("Calendar")
> oAppt.Send

> Set oRecip = Nothing
> Set colRecips = Nothing
> Set oAppt = Nothing
> End Sub
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
D Copy Appointment Body to Task Body Outlook VBA and Custom Forms 0
G Copy Contact field to Appointment Custom Form Field Outlook VBA and Custom Forms 2
G How to Copy Multi Select Listbox Data to Appointment Outlook VBA and Custom Forms 3
R How to copy outlook 2010 shared calendar appointment or meeting to personal calendar by vba? Outlook VBA and Custom Forms 1
C Copy from one Profile to another Using Outlook 0
M "Attachment Detacher for Outlook" add in, does it update the server copy of the email? Using Outlook 1
C Outlook 365 Copy/Save Emails in Folder Outside Outlook to Show Date Sender Recipient Subject in Header Using Outlook 0
M copy field value to custom field Outlook VBA and Custom Forms 0
O In Agenda-view - How to copy an existing item months ahead or back? Using Outlook 0
C Move or copy from field to field Outlook VBA and Custom Forms 0
Z Copy specific email body text Outlook VBA and Custom Forms 0
B Need to Copy an email to a subfolder Outlook VBA and Custom Forms 2
O Outlook 365 - How to create / copy a new contact from an existing one? Using Outlook 5
S Copy Tasks/Reminders from Shared Mailbox to Personal Tasks/Reminders Outlook VBA and Custom Forms 0
A Cannot copy this folder because it may contain private items Using Outlook 0
C Copy Move item won't work Outlook VBA and Custom Forms 2
Z VBA to convert email to task, insert text of email in task notes, and attach copy of original email Outlook VBA and Custom Forms 4
Commodore Move turns into "copy" Using Outlook 3
C Copy Outlook contact field value to another field Outlook VBA and Custom Forms 1
J Copy to calendar function no longer working in outlook 365 Using Outlook 5
F Copy and replace not update contact in another pst Using Outlook 0
B Outlook Business Contact Manager with SQL to Excel, User Defined Fields in BCM don't sync in SQL. Can I use VBA code to copy 1 field to another? BCM (Business Contact Manager) 0
Commodore Folders always closed in move/copy items dialog box Using Outlook 3
N Outlook rules don't create a copy for bcc'ed emails Using Outlook 3
geofferyh Outlook 2010 How to Copy Outlook Attachment to a Specific Folder? Outlook VBA and Custom Forms 3
S Custom Form, copy user field data to message body Outlook VBA and Custom Forms 12
R Copy Outlook Public Folders to a File Server Shared Folder Using Outlook 0
K Outlook Rules: Move a Copy Using Outlook 4
oliv- HOW TO COPY /USE FOLDERS ICONS Outlook VBA and Custom Forms 2
E Copy e-mail body from outlook and insert into excel Outlook VBA and Custom Forms 3
B Copy/Move Exchange inbox to Pop inbox Using Outlook 4
R Sending email copy (*.msg file) of sent email if subject line contains specific string. Outlook VBA and Custom Forms 1
O Copy mails from many subfolders to 1 foldr Using Outlook 2
K ind specific Subject line from outlook and copy the content of the email body to exce Outlook VBA and Custom Forms 0
K How to find specific header and copy the mail body Using Outlook 0
J Copy or Export Outlook Mail to Excel Outlook VBA and Custom Forms 6
Carrie Dickey Outlook 2016 created two calendars titled Calendar1 - appear to be a copy Using Outlook 2
P How to copy and append data from Outlook 2016 message into Excel 2016 workbook Using Outlook 0
Stilgar Relsik Create a rule to copy text from an email and paste it in the subject line. Using Outlook 1
R Macro to copy email to excel - Runtime Error 91 Object Variable Not Set Outlook VBA and Custom Forms 11
H Macro to Copy Specific content from Mail Body and Paste to Excel Outlook VBA and Custom Forms 4
M How to keep reccurence during copy tasks to calendar? Using Outlook 1
Diane Poremsky Copy New Appointments to Another Calendar using VBA Using Outlook 0
Diane Poremsky Use a macro to copy data in Outlook email to Excel workbook Using Outlook 0
C Copy Task to Non-Microsoft PIM "Rainlendar" Using Outlook 0
G VBA Copy draft email to a new email - attachments not copided Using Outlook 7
C Copy email to excel runtime error 5020 Using Outlook 5
I Copy email from folder to folder - FAILS Using Outlook 5
M Copy new appointments created in multiple shared calendars to another exchange calendar Outlook VBA and Custom Forms 1
Q Why can't I copy image with embedded hyperlink from email to Word Using Outlook 0

Similar threads

Back
Top