View Single Post
  #4  
Old May 31st 08, 01:10 AM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default How to change focus to added address card

I'm confused over whether you mean "form" and "item" in your description of the contents of the combo box. A form is a code/UI template. It contains no data, although it may have default values for certain fields. An item is the unit of data storage. It is linked to a particular form through the value of its MessageClass property.

So are you talking about published custom forms? Or are you talking about creating new items from existing items (which may or may not be using a custom form)? Or something else completely?

To create a new item that uses a custom form for its UI and code, use the Add method on the target folder's Items collection:

Set newItem = targetFolder.Items.Add("IPM.Post.YourFormName")

If it's a message form, use the Drafts folder as the target. If the target is a default folder, you can use the Namespace.GetDefaultFolder method to return it as a MAPIFolder object. To create an item in another person's mailbox, use Namespace.GetSharedDefaultFolder to get the MAPIFolder Otherwise, you can use the code at http://www.outlookcode.com/d/code/getfolder.htm to walk the folder hierarchy and return the MAPIFolder corresponding to a given path string.

To create a new item that is a copy of an existing item, call the Copy method on the item you want to copy:

Set newItem = oldItem.Copy

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Boein" wrote in message ...
OK then what happens if you're running a form from a folder and you want to
add a new one from within this form. If I do this the same data is in the
new form and the first form. What am I doing wrong.
This is what I want.
A folder with a collection of custom forms (ie modified contact-items).
Each form contains vbs and has a combobox and contact fields. This combobox
contains all the forms in the folder. If I select an item from this combobox
the corresponding form should be openend showing corresponding data in the
fields. If I chage a value in one of the fields and press a save button the
corresponding form shown in the combobox should be updated. Sounds easy,
but is not ;-)
Regards
Boein


"Sue Mosher [MVP-Outlook]" wrote:

You can't. Outlook provides no method for selecting a particular item in a folder view.

"Boein" wrote in message ...
Hi,
Using modified contact forms with vbs. After adding a contact from a
contact the focus is still set on the previous contact if you look at the
selected address cards. How can you set the focus on the added contact.
Thanks
Boein


Ads