M
Marty Peterson
Hello All,
I am have a form published in a Public Folder called Public Folders/All
Public Folders/Public Forms. Inside of this folder I have three forms. When
I run the form, the read page has a button on it that runs code. I have
pasted the problem part of the code below. I simply want to open a different
form that has been saved to this same Public Folder and copy some data into
it and display it on the screen for the user to send off.
I think that I am having a problem with it actually opening the form
correctly or maybe getting to the proper folder. I have attempted to "Walk
the Public Folder Tree" but think I may be missing something little. When I
run the code now, it displays my msbbox then locks up Outlook...
Here is the code in question:
1 Set objApp = CreateObject("Outlook.Application")
2 Set objNS = objApp.GetNamespace("MAPI")
3 Set objFolders = ObjNS.Folders
4 Set objPublicFolders = ObjFolders.Item("Public Folders")
5 Set objFolders = ObjPublicFolders.Folders
6 Set objAllPublicFolders = ObjFolders.Item("All Public Folders")
7 Set objFolders = ObjAllPublicFolders.Folders
8 Set objPublicForms = ObjFolders.Item("Public Forms")
9 Set InboxFoler = objPublicForms.Folders
10 Msgbox ("OK")
11 'pause
12 Set EmployeeItem = InboxFolder.Items.add("IPM.Note.Employee Add/Term
Results Form2")
13 EmployeeItem.userproperties.find("EmployeeName").Value =
item.userProperties.find("E-Name").Value
14 EmployeeItem.userproperties.find("Departmnt").Value =
item.userProperties.find("E-Dept").Value
15 EmployeeItem.userproperties.find("StartDate").Value =
item.userProperties.find("E-StartDate").Value
16 EmployeeItem.Subject = item.userProperties.find("E-Name").Value &
item.Subject
17 EmployeeItem.To = item.sendername
18 EmployeeItem.Subject = "Employee Add/Term Report for " &
EmployeeItem.userProperties.find"EmployeeName").Value
19 EmployeeItem.save
20 EmployeeItem.display
21 item.close(0)
I think that something isn't right on line 12 but am not sure.
Just to give some background, this used to be published in org. forms, but I
am trying to migrate to a public folder...
thanks in advanced,
Marty
I am have a form published in a Public Folder called Public Folders/All
Public Folders/Public Forms. Inside of this folder I have three forms. When
I run the form, the read page has a button on it that runs code. I have
pasted the problem part of the code below. I simply want to open a different
form that has been saved to this same Public Folder and copy some data into
it and display it on the screen for the user to send off.
I think that I am having a problem with it actually opening the form
correctly or maybe getting to the proper folder. I have attempted to "Walk
the Public Folder Tree" but think I may be missing something little. When I
run the code now, it displays my msbbox then locks up Outlook...
Here is the code in question:
1 Set objApp = CreateObject("Outlook.Application")
2 Set objNS = objApp.GetNamespace("MAPI")
3 Set objFolders = ObjNS.Folders
4 Set objPublicFolders = ObjFolders.Item("Public Folders")
5 Set objFolders = ObjPublicFolders.Folders
6 Set objAllPublicFolders = ObjFolders.Item("All Public Folders")
7 Set objFolders = ObjAllPublicFolders.Folders
8 Set objPublicForms = ObjFolders.Item("Public Forms")
9 Set InboxFoler = objPublicForms.Folders
10 Msgbox ("OK")
11 'pause
12 Set EmployeeItem = InboxFolder.Items.add("IPM.Note.Employee Add/Term
Results Form2")
13 EmployeeItem.userproperties.find("EmployeeName").Value =
item.userProperties.find("E-Name").Value
14 EmployeeItem.userproperties.find("Departmnt").Value =
item.userProperties.find("E-Dept").Value
15 EmployeeItem.userproperties.find("StartDate").Value =
item.userProperties.find("E-StartDate").Value
16 EmployeeItem.Subject = item.userProperties.find("E-Name").Value &
item.Subject
17 EmployeeItem.To = item.sendername
18 EmployeeItem.Subject = "Employee Add/Term Report for " &
EmployeeItem.userProperties.find"EmployeeName").Value
19 EmployeeItem.save
20 EmployeeItem.display
21 item.close(0)
I think that something isn't right on line 12 but am not sure.
Just to give some background, this used to be published in org. forms, but I
am trying to migrate to a public folder...
thanks in advanced,
Marty