A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Adding a Meeting Room Resource - Code attached



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old December 6th 06, 07:19 PM posted to microsoft.public.outlook.program_vba
callmedoug
external usenet poster
 
Posts: 13
Default Adding a Meeting Room Resource - Code attached

Well, thanks to the folks here on this group I was able to write the
VBA code needed to add a meeting room to an open meeting. I thought I
would share the code here for others to use or improve upon.

This code would be attached to a form with;
1) listbox (lbxRooms)
2) button (cmdCancel)


I then created a macro attached to the meeting schedule window to load
and show the form when activated.


regards,
DP
==============code=================

Option Explicit
Dim strCity As String 'city code used in address name
Dim strRooms As String 'address entries
Dim Meeting 'current meeting
Dim myRecipient 'the room I finally pick
Dim UseThisRoom 'the room I finally pick
Dim myAddressList As AddressList 'address list
Dim AddressEntry As AddressEntry 'addressentry


Private Sub UserForm_Initialize()
Call GetRooms
End Sub


Sub GetRooms()

'use the global address book, incase another is default
Set myAddressList = Application.Session.AddressLists("Global Address
List")

' go through address book and get each meeting room
For Each AddressEntry In myAddressList.AddressEntries

strRooms = AddressEntry.Name

'look only at mtgrm entries (all room anmes begin with mtgrm)
If Left(strRooms, 5) = "mtgrm" Then
'look for the available rooms
Call GetFreeBusyInfo
End If

Next
End Sub


Sub GetFreeBusyInfo()

Dim myFBInfo As String 'getfreebusy information for the meeting date
Dim MyStart 'meeting start tiem and date
Dim MyDur 'number of minutes in length the meeting is
Dim MyStartTime 'number of minutes after midnight meeting starts

'use the active meeting as reference
Set Meeting = Outlook.ActiveInspector.CurrentItem

MyStart = Meeting.Start 'get the meeting start from active meeting
MyDur = Meeting.Duration - 1 'get dureation from active meeting

'get number of minutes between midnight and MyStart
MyStartTime = DateDiff("n", (Format(MyStart, "Short Date") & "
12:00:00 AM"), MyStart)


On Error GoTo ErrorHandler 'ignore rooms that where freebusy is not
available

'get the freebusy time for the meetign date
myFBInfo = AddressEntry.GetFreeBusy(MyStart, 1)

'see if time is available (all minutes within meeting duration are
0)
If Mid(myFBInfo, MyStartTime, MyDur) = 0 Then
'if available add it to the listbox
lbxRooms.AddItem AddressEntry.Name
End If

ErrorHandler:

End Sub

Private Sub lbxRooms_DblClick(ByVal Cancel As MSForms.ReturnBoolean)

'use the room that is double clicked on
UseThisRoom = lbxRooms.Value

'add the selected room to current object as a resource
Set Meeting = Outlook.ActiveInspector.CurrentItem
Set myRecipient = Meeting.Recipients.Add(UseThisRoom)
myRecipient.Type = olResource

'unload form after room is added, since only one room is ever needed
Unload Me
End Sub


Private Sub cmdCancel_Click()
'cancel and close the form without adding a room
Unload Me
End Sub

Ads
 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Add a meeting room as Resource Blueberries Outlook - Calandaring 0 November 20th 06 09:11 AM
Outlook XP \ Exchange 2003 - meeting room added as a resource not retained when date changed QH Outlook - Calandaring 0 August 15th 06 05:33 PM
How do you set a capacity limit for a resource (meeting room)? SDavis Outlook - Calandaring 2 June 21st 06 12:53 PM
conference room without Resource monmha Outlook - Installation 3 May 24th 06 04:15 PM
Resource Room booking WooYing Outlook - General Queries 8 April 26th 06 10:45 PM


All times are GMT +1. The time now is 10:42 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.