Sue, thnx for the help on the constant-declaration.
We've decided to add a custom command bar. i'll add the code here, i
may be useful for someone else.
when i have more issues i'll post them here
Code
-------------------
Sub cmdTaakVerkoop_Click()
Dim objFolder
Dim objItem
Dim strMsgClass
Dim strFolderPath
If mblnReadFromFolder Then
mblnReadFromFolder = False
End If
WriteRegister
'where Testomgeving 2502 is the name of the .PST and
strFolderPath = "Testomgeving 2502/Taken Verkoop TO"
strMsgClass = "IPM.Task.TakenVerkoopTest2502"
If strFolderPath = "" Then
Set objFolder = UserDefaultFolder(Item.UserProperties("FormType").Value)
Else
Set objFolder = GetMAPIFolder(strFolderPath)
End If
If Not objFolder Is Nothing And strMsgClass <> "" Then
On Error Resume Next
Set objItem = objFolder.Items.Add(strMsgClass)
objItem.Display
Else
MsgBox "Could not locate " & strFolderPath & " folder.", , "Problem finding folder"
End If
Item_Open = False
Set objItem = Nothing
Set objFolder = Nothing
End Sub
-------------------
*You're almost there!
1) Again, Application and Item are *intrinsic* objects in for
script. You
don't declare them. You don't instantiate them. You just use thos
objects.
Take out the Dim Application and Set Application statements.
2) You did fine on removing the typed variable declarations.
3) Learn to use the object browser. Press ALt+F11 to open the VBA
environment in Outlook, then press F2. You're now looking at all the
objects, etc. for Outlook. To look up the literal value for the
olFolderTasks constant, type that constant name into the empty bo
next to
the button with the binoculars (the Find button) and then click the
binoculars. You will olFolderTasks in the Member column of th
search
results and can then see its literal value (13) at the bottom of th
window.
You'll also see the full text of a Const declaration statement tha
you can
copy and paste into the declarations section of your procedure, s
you can
continue to use olFolderTasks in your code (but you'll need t
correct it in
your code below where you have olFolderTaken instead).
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers