I receive an error ("Could not complete the operation. One or more
parameters are invalid.") when I insert the code you replied with.
MyItem.Links.Add(Item)
I am assuming that "Item" in parens needs to be replaced with a valid object
name - but which one? Do I place the field name that I am pulling from or
the destination location? Do they need to be named the same on both forms?
I would like to pass the value from the "FullName" field of the modified
Contact form to a "Contacts..." field setup on the new custom form the
command button is opening - Here is what I have:
Sub CommandButton1_Click()
Set olns = Item.Application.GetNameSpace("MAPI")
Set MyFolder1 = olns.Folders("Public Folders")
Set MyFolder2 = MyFolder1.Folders("All Public Folders")
Set MyFolder3 = MyFolder2.Folders("Shamrock")
Set MyFolder4 = MyFolder3.Folders("General")
Set MyFolder5 = MyFolder4.Folders("Customer Notes")
Set MyItem = MyFolder5.Items.Add
MyItem.Links.Add(FullName)
MyItem.Display
End Sub
"Sue Mosher [MVP-Outlook]" wrote:
> MyItem.Links.Add(Item)
>
> --
> Sue Mosher, Outlook MVP
> Author of
> Microsoft Outlook Programming - Jumpstart for
> Administrators, Power Users, and Developers
> http://www.outlookcode.com/jumpstart.aspx
>
>
> "Mike" <(E-Mail Removed)> wrote in message news:9D83CFF4-0E58-4F9A-88BE-(E-Mail Removed)...
> > Thank you for your help! I can now open a new (different) from from a
> > command button, but I am still not sure how to have the form open with a
> > value from the original form "prepopulated."
> >
> > In my case, I am opening up a new note form from a modified Contact from and
> > would like to have the "Contact" value in the new form filled out
> > automatically when the new Note form is launched from the original form - Is
> > this possible?
> >
> > Here is my current code to open the new note form from a command button:
> >
> > Sub CommandButton1_Click()
> > Set olns = Item.Application.GetNameSpace("MAPI")
> > Set MyFolder1 = olns.Folders("Public Folders")
> > Set MyFolder2 = MyFolder1.Folders("All Public Folders")
> > Set MyFolder3 = MyFolder2.Folders("Shamrock")
> > Set MyFolder4 = MyFolder3.Folders("General")
> > Set MyFolder5 = MyFolder4.Folders("Customer Notes")
> > Set MyItem = MyFolder5.Items.Add
> > MyItem.Display
> > End Sub
> >
> > "Sue Mosher [MVP-Outlook]" wrote:
> >
> >> To create a new instance of a custom form programmatically, use the Add method on the target folder's Items collection. If it's a message form, you can 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. 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.
>
> >>
> >> "Mike" <(E-Mail Removed)> wrote in message news:41C01F40-8844-4CAF-8930-(E-Mail Removed)...
> >> >I am extremely limited in my programming skills, but desperately need to open
> >> > up a modified version of the "Post" template up from a command button on a
> >> > modified "Contact" form. The new form also needs to be prepopulated.
> >> >
> >> > I have created both new forms and saved them, but I have been unable to
> >> > figure out how to correctly setup the command button on the "Contact" form to
> >> > open up the "Post" form. I have both forms in seperate Public Folders on my
> >> > Exchange Server and in the Properties on the folder in which the modified
> >> > "Contact" form resides, I have setup the "Activities" to look for the "Post"
> >> > items in the other public folder.
> >> >
> >> > I cannot seem to find the answers I am looking for in opther threads, so
> >> > please forgive me if I am being repetitive, here!
> >> >
> >> > Ultimately, I need to have a command button that opens up a new form and
> >> > "passes" it a parameter (in this case the Contact or Contacts) for the new
> >> > form to be pre-populated.
> >> >
> >> > If anyone knows of any sample .oft that I could model after or any resources
> >> > that I may have missed - please help!!!
> >>
>