Creating appointment on public calendars


G

Guest

Hi,

I'm using Access along with Outlook 2003. And I'm wondering if there is a
way to create an appointment on a specific calendar.

This is the code I'm using.

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)
...

This code creates the appointment on the default calendar. But I want to
create the appointment on a public calendar and be able to choose what
calendar.

Thanks in advance,

Oscar M.
 
Ad

Advertisements

S

Sue Mosher [MVP-Outlook]

Or better yet, get the target folder first, then use the MAPIFolder.Items.Add method to create the item directly in the folder. To get a non-default folder, you need to 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
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


Ken Slovak - said:
Create it and move it to the folder you want.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


OscarM said:
Hi,

I'm using Access along with Outlook 2003. And I'm wondering if there is a
way to create an appointment on a specific calendar.

This is the code I'm using.

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)
...

This code creates the appointment on the default calendar. But I want to
create the appointment on a public calendar and be able to choose what
calendar.

Thanks in advance,

Oscar M.
 
G

Guest

Thank you for your response.

I have three calendars on the same public folder ("Public Foldes\All Public
Folders"). How can I select which calandar I want to update?

Thanks,
Oscar M.
 
S

Sue Mosher [MVP-Outlook]

Each calendar is a folder. Return it as a MAPIFolder object using either of the methods I suggested.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
G

Guest

It works! Thank you!


Sue Mosher said:
Each calendar is a folder. Return it as a MAPIFolder object using either of the methods I suggested.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Ad

Advertisements

G

Guest

Hello,

please help to beginner
I tried to use it, but I must do something wrong. I never get from line two.
:)

Sub cmdopenapp_Click()
Function GetFolder(\\Veřejné složky\Všechny veřejné složky\Kalendáře\Dec)
I tried it with and without brackets and also with/without double
apostrophes but allways BAD SYNTAX

P.S. - is this really what I need ? I want to make a button, which will open
a new appointment in the specific folder.

Thank you very much


Sue Mosher [MVP-Outlook] píše:
 
S

Sue Mosher [MVP-Outlook]

Two problems:

1) You don't need to change the declaration of the GetFolder() function. Leave it alone.

2) You need to call GetFolder() from your Click procedure and get its return MAPIFolder value. The argument for GetFolder must be a string . Surround your path in quotation marks:

Sub cmdopenapp_Click()
Set myFolder = GetFolder("\\Veřejné složky\Všechny veřejné složky\Kalendáře\Dec")
' check whether the folder exists
If Not Is Nothing myFolder Then
' your code to perform operations on myFolder goes next, e.g.
Set myAppt = myFolder.Items.Add
Else
MsgBox "Could not get folder"
End If
End Sub

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


Johny said:
Hello,

please help to beginner
I tried to use it, but I must do something wrong. I never get from line two.
:)

Sub cmdopenapp_Click()
Function GetFolder(\\Veřejné složky\Všechny veřejné složky\Kalendáře\Dec)
I tried it with and without brackets and also with/without double
apostrophes but allways BAD SYNTAX

P.S. - is this really what I need ? I want to make a button, which will open
a new appointment in the specific folder.

Thank you very much


Sue Mosher [MVP-Outlook] píše:
Or better yet, get the target folder first, then use the MAPIFolder.Items.Add method to create the item directly in the folder. To get a non-default folder, you need to 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
 
G

Guest

Thank you very much for your answer ,

especially Iam happy you have send me part of script. I was looking for it
for the whole day :)

I tried it, but:
if I translate it, it is somethink like: Mismatch of GetFolder

Pls.....could you help me again :)




Sue Mosher said:
Two problems:

1) You don't need to change the declaration of the GetFolder() function. Leave it alone.

2) You need to call GetFolder() from your Click procedure and get its return MAPIFolder value. The argument for GetFolder must be a string . Surround your path in quotation marks:

Sub cmdopenapp_Click()
Set myFolder = GetFolder("\\Veřejné složky\Všechny veřejné složky\Kalendáře\Dec")
' check whether the folder exists
If Not Is Nothing myFolder Then
' your code to perform operations on myFolder goes next, e.g.
Set myAppt = myFolder.Items.Add
Else
MsgBox "Could not get folder"
End If
End Sub

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


Johny said:
Hello,

please help to beginner
I tried to use it, but I must do something wrong. I never get from line two.
:)

Sub cmdopenapp_Click()
Function GetFolder(\\Veřejné složky\Všechny veřejné složky\Kalendáře\Dec)
I tried it with and without brackets and also with/without double
apostrophes but allways BAD SYNTAX

P.S. - is this really what I need ? I want to make a button, which will open
a new appointment in the specific folder.

Thank you very much


Sue Mosher [MVP-Outlook] píše:
Or better yet, get the target folder first, then use the MAPIFolder.Items.Add method to create the item directly in the folder. To get a non-default folder, you need to 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

Create it and move it to the folder you want.


Hi,

I'm using Access along with Outlook 2003. And I'm wondering if there is a
way to create an appointment on a specific calendar.

This is the code I'm using.

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)
...

This code creates the appointment on the default calendar. But I want to
create the appointment on a public calendar and be able to choose what
calendar.

Thanks in advance,

Oscar M.
 
S

Sue Mosher [MVP-Outlook]

Add an On Error Resume Next statement to the beginning of your procedure, then step through the code with F8 to find out why Outlook can't find the folder based on the path you are providing. (My guess is that the path string is not correct.)

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


Johny said:
Thank you very much for your answer ,

especially Iam happy you have send me part of script. I was looking for it
for the whole day :)

I tried it, but:
if I translate it, it is somethink like: Mismatch of GetFolder

Pls.....could you help me again :)




Sue Mosher said:
Two problems:

1) You don't need to change the declaration of the GetFolder() function. Leave it alone.

2) You need to call GetFolder() from your Click procedure and get its return MAPIFolder value. The argument for GetFolder must be a string . Surround your path in quotation marks:

Sub cmdopenapp_Click()
Set myFolder = GetFolder("\\Veřejné složky\Všechny veřejné složky\Kalendáře\Dec")
' check whether the folder exists
If Not Is Nothing myFolder Then
' your code to perform operations on myFolder goes next, e.g.
Set myAppt = myFolder.Items.Add
Else
MsgBox "Could not get folder"
End If
End Sub


Johny said:
Hello,

please help to beginner
I tried to use it, but I must do something wrong. I never get from line two.
:)

Sub cmdopenapp_Click()
Function GetFolder(\\Veřejné složky\Všechny veřejné složky\Kalendáře\Dec)
I tried it with and without brackets and also with/without double
apostrophes but allways BAD SYNTAX

P.S. - is this really what I need ? I want to make a button, which will open
a new appointment in the specific folder.

Thank you very much


Sue Mosher [MVP-Outlook] píše:

Or better yet, get the target folder first, then use the MAPIFolder.Items.Add method to create the item directly in the folder. To get a non-default folder, you need to 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

Create it and move it to the folder you want.


Hi,

I'm using Access along with Outlook 2003. And I'm wondering if there is a
way to create an appointment on a specific calendar.

This is the code I'm using.

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)
...

This code creates the appointment on the default calendar. But I want to
create the appointment on a public calendar and be able to choose what
calendar.

Thanks in advance,

Oscar M.
 
G

Guest

I'am afraid this is my mistake...
I did'n notice that Oscar wrote : I'm using Access along with Outlook 2003
but I'm making a script in outlook form.

Can be this the problem ?
I used F8 as you said and VB wrote: Compile Error:, Sub or function is not
defined

I'am very sorry if this is the reason



Sue Mosher said:
Add an On Error Resume Next statement to the beginning of your procedure, then step through the code with F8 to find out why Outlook can't find the folder based on the path you are providing. (My guess is that the path string is not correct.)

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


Johny said:
Thank you very much for your answer ,

especially Iam happy you have send me part of script. I was looking for it
for the whole day :)

I tried it, but:
if I translate it, it is somethink like: Mismatch of GetFolder

Pls.....could you help me again :)




Sue Mosher said:
Two problems:

1) You don't need to change the declaration of the GetFolder() function. Leave it alone.

2) You need to call GetFolder() from your Click procedure and get its return MAPIFolder value. The argument for GetFolder must be a string . Surround your path in quotation marks:

Sub cmdopenapp_Click()
Set myFolder = GetFolder("\\Veřejné složky\Všechny veřejné složky\Kalendáře\Dec")
' check whether the folder exists
If Not Is Nothing myFolder Then
' your code to perform operations on myFolder goes next, e.g.
Set myAppt = myFolder.Items.Add
Else
MsgBox "Could not get folder"
End If
End Sub


Hello,

please help to beginner
I tried to use it, but I must do something wrong. I never get from line two.
:)

Sub cmdopenapp_Click()
Function GetFolder(\\Veřejné složky\Všechny veřejné složky\Kalendáře\Dec)
I tried it with and without brackets and also with/without double
apostrophes but allways BAD SYNTAX

P.S. - is this really what I need ? I want to make a button, which will open
a new appointment in the specific folder.

Thank you very much


Sue Mosher [MVP-Outlook] píše:

Or better yet, get the target folder first, then use the MAPIFolder.Items.Add method to create the item directly in the folder. To get a non-default folder, you need to 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

Create it and move it to the folder you want.


Hi,

I'm using Access along with Outlook 2003. And I'm wondering if there is a
way to create an appointment on a specific calendar.

This is the code I'm using.

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)
...

This code creates the appointment on the default calendar. But I want to
create the appointment on a public calendar and be able to choose what
calendar.

Thanks in advance,

Oscar M.
 
Ad

Advertisements

S

Sue Mosher [MVP-Outlook]

What statement raises that error? You did add the GetFolder() function to your project, didn't you?
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


Johny said:
I'am afraid this is my mistake...
I did'n notice that Oscar wrote : I'm using Access along with Outlook 2003
but I'm making a script in outlook form.

Can be this the problem ?
I used F8 as you said and VB wrote: Compile Error:, Sub or function is not
defined

I'am very sorry if this is the reason



Sue Mosher said:
Add an On Error Resume Next statement to the beginning of your procedure, then step through the code with F8 to find out why Outlook can't find the folder based on the path you are providing. (My guess is that the path string is not correct.)

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


Johny said:
Thank you very much for your answer ,

especially Iam happy you have send me part of script. I was looking for it
for the whole day :)

I tried it, but:
if I translate it, it is somethink like: Mismatch of GetFolder

Pls.....could you help me again :)




:

Two problems:

1) You don't need to change the declaration of the GetFolder() function. Leave it alone.

2) You need to call GetFolder() from your Click procedure and get its return MAPIFolder value. The argument for GetFolder must be a string .. Surround your path in quotation marks:

Sub cmdopenapp_Click()
Set myFolder = GetFolder("\\Veřejné složky\Všechny veřejné složky\Kalendáře\Dec")
' check whether the folder exists
If Not Is Nothing myFolder Then
' your code to perform operations on myFolder goes next, e.g.
Set myAppt = myFolder.Items.Add
Else
MsgBox "Could not get folder"
End If
End Sub
Hello,

please help to beginner
I tried to use it, but I must do something wrong. I never get from line two.
:)

Sub cmdopenapp_Click()
Function GetFolder(\\Veřejné složky\Všechny veřejné složky\Kalendáře\Dec)
I tried it with and without brackets and also with/without double
apostrophes but allways BAD SYNTAX

P.S. - is this really what I need ? I want to make a button, which will open
a new appointment in the specific folder.

Thank you very much


Sue Mosher [MVP-Outlook] píše:

Or better yet, get the target folder first, then use the MAPIFolder.Items.Add method to create the item directly in the folder. To get a non-default folder, you need to 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

Create it and move it to the folder you want.


Hi,

I'm using Access along with Outlook 2003. And I'm wondering if there is a
way to create an appointment on a specific calendar.

This is the code I'm using.

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)
...

This code creates the appointment on the default calendar. But I want to
create the appointment on a public calendar and be able to choose what
calendar.

Thanks in advance,
 
G

Guest

I'm sorry but I don't understand what exactly you mean.
I try to design a form in outlook. I made a button and in script window is
filled only this:

Sub cmdapp_Click()
Set myFolder = GetFolder("\\Veřejné složky\Všechny veřejné složky\Kalendáře")
If Not myFolder Is Nothing Then
Set myAppt = myFolder.Items.Add
Else
MsgBox "Could not get folder"
End If
End Sub

Then I save the form in public folder and start it. When I press the
button, it raise message: Mismatch type: 'Getfolder'

The second message(Compile Error:, Sub or function is not defined )
appeared, when I copied this script to VB (alt+F11) and pressed F8. word
Getfolder was highligted and this message appeared.


When I pressed F1 on getfolder in VB, it did't show me any help. Is it OK ?

Thank you very much for hepl.


Sue Mosher [MVP-Outlook] píše:
 
S

Sue Mosher [MVP-Outlook]

Next time, please try to take time to understand what you read either here or on programming web sites, rather than just quickly copying and pasting. GetFolder() is not a method built into Outlook. As one of my earlier responses explained, it is a function that can return a folder by traversing the folder hierarchy. But you must add that function to your code. Your form will not work without it. The link I originally provided was http://www.outlookcode.com/d/code/getfolder.htm.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


Johny said:
I'm sorry but I don't understand what exactly you mean.
I try to design a form in outlook. I made a button and in script window is
filled only this:

Sub cmdapp_Click()
Set myFolder = GetFolder("\\Veřejné složky\Všechny veřejné složky\Kalendáře")
If Not myFolder Is Nothing Then
Set myAppt = myFolder.Items.Add
Else
MsgBox "Could not get folder"
End If
End Sub

Then I save the form in public folder and start it. When I press the
button, it raise message: Mismatch type: 'Getfolder'

The second message(Compile Error:, Sub or function is not defined )
appeared, when I copied this script to VB (alt+F11) and pressed F8. word
Getfolder was highligted and this message appeared.


When I pressed F1 on getfolder in VB, it did't show me any help. Is it OK ?

Thank you very much for hepl.


Sue Mosher [MVP-Outlook] píše:
What statement raises that error? You did add the GetFolder() function to your project, didn't you?
 
G

Guest

I'am very sorry, reading in english makes me trouble

please.....could you just write me, if this is the right part of your
article, which I must use ? I read it 100times but Iam not able to start the
form.....bad syntax on line with getfolder


' Code Sample (VBScript for Outlook form)
Function GetFolder(FolderPath)
' folder path needs to be something like
' "Public Folders\All Public Folders\Company\Sales"
Dim aFolders
Dim fldr
Dim i
Dim objNS

On Error Resume Next
strFolderPath = Replace(FolderPath, "/", "\")
aFolders = Split(FolderPath, "\")

'get the Outlook objects
' use intrinsic Application object in form script
Set objNS = Application.GetNamespace("MAPI")

'set the root folder
Set fldr = objNS.Folders(aFolders(0))

'loop through the array to get the subfolder
'loop is skipped when there is only one element in the array
For i = 1 To UBound(aFolders)
Set fldr = fldr.Folders(aFolders(i))
'check for errors
If Err <> 0 Then Exit Function
Next
Set GetFolder = fldr

' dereference objects
Set objNS = Nothing
End Function


thank you very much
 
S

Sue Mosher [MVP-Outlook]

It looks like you've already done that for yourself. Two steps are involved:

1) Copy the entire GetFolder() function for VBScript, as you have it below, into your form's code module as a new procedure.

2) Call GetFolder() with a folder path string. YOu had it like this in your earlier post:

Set myFolder = GetFolder("\\Veřejné složky\Všechny veřejné složky\Kalendáře")

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Ad

Advertisements

G

Guest

I must give it up. I never get over this line:
Function GetFolder ("\\Veřejné složky\Všechny veřejné složky\Kalendáře")
always error message: Bad syntax

I realy appreciate you spent with me so much time.
Thanks a lot !
 
S

Sue Mosher [MVP-Outlook]

There's no need to give up. You just need to understant how to call a function. If you have a function with a parameter, like this:

Function GetFolder(FolderPath)
' some code
End Function

You don't change anything about that function's definition. Instead, you call it from another program, passing the value you want the parameter to have:

Set myFolder = GetFolder("\\Veřejné složky\Všechny veřejné složky\Kalendáře")

So, again, you need to copy the GetFolder() function ****exactly as you found it****. Don't change a thing about it, especially the procedure declaration. Leave it as Function GetFolder(FolderPath).

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
G

Guest

Iam very sorry but I must do some great novice mistake. Script stops on line
with GETFOLDER. Is possible that my outlook doesnt know "getfolder" ? It is
stupid question, I know... but it says: mismatch getfolder. if I rename it to
Function cmdapp_Click() getfolder2().....It says: Mismatch getfolder2


Just to be sure, I try to make a script which will be started by a button.
This button is placed in outlook 2003 form. I have W2000 SB server. The
script should create a new appointment in defined folder. Is this all ok ?


This is what I have just now in my form script.


Function cmdapp_Click() getfolder("Veřejné složky\Všechny veřejné
složky\Kalendáře")
Dim aFolders
Dim fldr
Dim i
Dim objNS
On Error Resume Next
strFolderPath = Replace("Veřejné složky\Všechny veřejné složky\Kalendáře",
"/", "\")
aFolders = Split("Veřejné složky\Všechny veřejné složky\Kalendáře", "\")

Set objNS = Application.GetNamespace("MAPI")
Set fldr = objNS.Folders(aFolders(0))
For i = 1 To UBound(aFolders)
Set fldr = fldr.Folders(aFolders(i))
If Err <> 0 Then Exit Function
Next
Set GetFolder = fldr

' dereference objects
Set objNS = Nothing

Set myFolder = GetFolder("\\Veřejné složky\Všechny veřejné složky\Kalendáře")
End Function

I am so sorry and thank you for your patience.




Sue Mosher [MVP-Outlook] píše:
 
Ad

Advertisements

S

Sue Mosher [MVP-Outlook]

I know English is not your first language, but I don't know how I could have made the instructions any clearer. These are not Outlook issues you're dealing with but issues of very, very basic programming syntax. Let me try one more time. Please follow these steps exactly:

1) Copy the VBScript version of the GetFolder() function from the http://www.outlookcode.com/d/code/getfolder.htm page to your form's code module. COPY IT **EXACTLY.** DO NOT CHANGE ANYTHING ABOUT THIS FUNCTION. IT IS A SEPARATE PROCEDURE. DO NOT TRY TO COMBINE IT WITH SOME OTHER PROCEDURE.

2) Create a subroutine for your command button. If the button is named cmdapp, then the procedure declaration for the Click event handler procedure is Sub cmdapp_Click() -- NOTHING MORE, NOTHING LESS.

3) Inside that Click event handler, declare the variables you need, and call the GetFolder() function, passing the folder path as a string. Then test the returned object from the GetFolder() function and write the rest of the code to use that folder. Here is a shell:

Sub cmdapp_Click()
' variable declaration go here
Dim myFolder ' As MAPIFolder
' end of variable declarations

Set myFolder = GetFolder("Veřejné složky\Všechny veřejné složky\Kalendáře")
If myFolder Is Nothing Then
MsgBox "Could not get folder"
Else
' do work with myFolder, for example
strMsg = "The " & myFolder.Name & " folder has " & myFolder.Items.Count & " items."
MsgBox strMsg
End If

' release all object variables that were instantiated with Set statements
Set myFolder = Nothing
End Sub

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


Johny said:
Iam very sorry but I must do some great novice mistake. Script stops on line
with GETFOLDER. Is possible that my outlook doesnt know "getfolder" ? It is
stupid question, I know... but it says: mismatch getfolder. if I rename it to
Function cmdapp_Click() getfolder2().....It says: Mismatch getfolder2


Just to be sure, I try to make a script which will be started by a button.
This button is placed in outlook 2003 form. I have W2000 SB server. The
script should create a new appointment in defined folder. Is this all ok ?


This is what I have just now in my form script.


Function cmdapp_Click() getfolder("Veřejné složky\Všechny veřejné
složky\Kalendáře")
Dim aFolders
Dim fldr
Dim i
Dim objNS
On Error Resume Next
strFolderPath = Replace("Veřejné složky\Všechny veřejné složky\Kalendáře",
"/", "\")
aFolders = Split("Veřejné složky\Všechny veřejné složky\Kalendáře", "\")

Set objNS = Application.GetNamespace("MAPI")
Set fldr = objNS.Folders(aFolders(0))
For i = 1 To UBound(aFolders)
Set fldr = fldr.Folders(aFolders(i))
If Err <> 0 Then Exit Function
Next
Set GetFolder = fldr

' dereference objects
Set objNS = Nothing

Set myFolder = GetFolder("\\Veřejné složky\Všechny veřejné složky\Kalendáře")
End Function

I am so sorry and thank you for your patience.




Sue Mosher [MVP-Outlook] píše:
There's no need to give up. You just need to understant how to call a function. If you have a function with a parameter, like this:

Function GetFolder(FolderPath)
' some code
End Function

You don't change anything about that function's definition. Instead, you call it from another program, passing the value you want the parameter to have:

Set myFolder = GetFolder("\\Veřejné složky\Všechny veřejné složky\Kalendáře")

So, again, you need to copy the GetFolder() function ****exactly as you found it****. Don't change a thing about it, especially the procedure declaration. Leave it as Function GetFolder(FolderPath).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top