Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening * Populating Form in selected folder in Outlook using VBScript

Status
Not open for further replies.

Grippen

Technical User
Sep 3, 2001
24
GB
Hi,

I have a form I've designed showing Company details (Address, Products etc.). I'm trying to write VBScript Code that will initiate (on a Command Button) which will create and part populate a Contact Form in another Folder (not my default "Contacts" folder. Once the Contact is created, I want the Contact Name to be sucked back into the original form into a list box.

I'm part way there by using the "Actions" page on the Company Form (using code below) but I can't get the Contact to be in another Folder (i.e. other than the one with the Companydetails in). Any ideas?

Thanks

'**********************************************
sub cmdAddAccountContact_Click
Item.Save
Set AccountContactForm = item.Actions("Create New Account Contact").Execute
AccountContactForm.Display(True)
call cmdRefreshContactsList_Click
end sub

'************************************************

'************************************************
Sub cmdRefreshContactsList_Click
'Initialize ListBox
set oListBox = oDefaultPage.Controls("lstContacts")
oListBox.Clear
oListBox.ColumnWidths = "0;130;150;80;120"

'Create Search Criteria
RestrictString = ""
RestrictString = "[Message Class] = ""IPM.Contact.Account contact"" and [Conversation] = """ & item.ConversationTopic & """"
Set oRestrictedContactItems = oCurrentFolder.Items.Restrict(RestrictString)

for i = 0 to oRestrictedContactItems.Count - 1
oListBox.AddItem
oListBox.Column(1,i) = oRestrictedContactItems(i+1).FullName
oListBox.Column(2,i) = oRestrictedContactItems(i+1).JobTitle
oListBox.Column(3,i) = oRestrictedContactItems(i+1).BusinessTelephoneNumber
oListBox.Column(4,i) = oRestrictedContactItems(i+1).Email1Address
next
End Sub

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top