View Full Version : Load Form in Personal Forms Library With VBA
The form of my contact has a number of extra fields that I use for insert information regarding the contacts.
I have Yes/No fields, Date/Time fields, and Combobox fields.
In the past, I have the macro codes that if I identify a contact in a contact folder or subfolders, or open a contact, I create a email to that contact.
Is there a macro form that identifies the name of the field in the form of the contacts, and when I identify or open a contact, I run the macro and it adds to the field the words I want to use? This way if I am going thru 500 contacts and each one needs the same words or date in a field, I can add to them much much faster.
This would be another upgrade that would be helpful!! Thanks so much!!!
I have the code that does what I asked....and what I need if possible, is a macro code that when I highlight a contact, when run the macro, it clicks on a specific commandbutton in the contact......the contact form is in my Personal Forms Library and the name of the Contact form is "Contact Form 1"
Does anyone have a code this please?
Ims, Can you share the solution with us, please.
You should be able to use something like:
Load [LibraryName].Forms("Contact Form 1")
With Forms("Contact Form 1")
.[Required Input Control Name].Value = Selection
.CommandButton1_Click
End With
Forms("Contact Form 1").Unload
So add the words Personal Forms Library to the space LibraryName??.....and put a Private Sub [name] () and End Sub at the end? And please tell me what I do in the area you named "Required Input Control Name" ...is there something to do to that area?
As I am not the expert and I appreciate your quick response
I tested this in Excel, since I don't have Outlook installed. I had to change the Commandbutton_click Sub t
Private Sub ClickRemoteCommandButton()
Load ContactForm1
ContactForm1.CommandButton1_Click
Unload ContactForm1
End Sub
I had to remove the Keyword "Private" from in front of the Commandbutton_Click Sub.
Sub CommandButton1_Click()
MsgBox ""
End Sub
So the code to try as a macro when I highlight a contact is the following:
Sub ClickRemoteCommandButton()
Load ContactForm1
ContactForm1.CommandButton1_Click
Unload ContactForm1
End Sub
I ran the code above but the error shows up and the words "Load ContactForm1" show up as yellow color
You must use the exact names of the Form and the command button as shown in the VBA Properties Window.
Where is the VBA Properties window please...as I have used the correct names based on the when I open up the design form area....so what else do I find?
Or should there be something before the Load for purposes of Outlook?
In VBA Press Ctrl+R, then Press F4, or you can use the VBA Menu "View" and select Project Explorer and Properties Window
All do respect, this is not clear.....I have put the code you gave me in a Module in the VBA and then as a macro, it shows up under that names of the macros.....my contact form is the following: Contact Form 1 and below it when I go to the list of forms in my Personal Forms Library, that is the name and below it shows up as IPM.Contact.Contact Form 1 and the commandbutton in the contact form is a commandbutton that runs a code from the Script area of the contact form and the commandbutton is Commandbutton4.
So I am not sure what to adjust when I simply create the macro you gave me, when I highlight a contact not opening it up, and I run the macro, it effectively clicks the Commandbutton4 inside the contact I highlighted....
So what should I fix in details...if you can write down the full code and any Function to put it, I appreciate it.
IMS,
We are getting out of my field now. I have never really used Outlook and don't have it installed.
I am going to change the title of this thread to see if we can attract an Outlook Power user for you.
Thank you very much.....can you please change the title so it's clear that it's to load a form but just click on a commandbutton in it from the macro?
You can't "Click" the button without loading the form first. Without the Form, there is no button.
Can't you just copy the Button's code into the macro you want to click the button?
The code in script does is not the same in a macro....I was told there are changes to a script from the contact form to do the same as a macro in the VBA.....so here is the script code that updates the Task of the Contact and all fields in the Task form from the Contact fields relate to them....so if you know what to upgrade as a macro in the VBA, that would be very helpful. Thank you very much.
Sub btnUpdateTasks_Click
dim ContactName
dim olns
dim MyFolder
dim NumItems
dim myItems
dim TaskCount
Dim Str,Str1,Str2,Str3,Str4,Str5,Str6,Str7,Str8,Str9,Str10,Str11,Str12,Str13,St r14,Str15,Str16,Str17,Str18,Str19
Dim StartDate
Dim DueDate
Dim Recipients
TaskCount = 0
Str = Item.GetInspector.ModifiedFormPages("General").Controls("ComboBox7").Value
Str1 = Item.GetInspector.ModifiedFormPages("General").Controls("ComboBox8").Value
Str2 = Item.GetInspector.ModifiedFormPages("General").Controls("TextBox5").Value
Str3 = Item.GetInspector.ModifiedFormPages("General").Controls("Initial Intro").Value
Str4 = Item.GetInspector.ModifiedFormPages("General").Controls("Intro Date").Value
Str5 = Item.GetInspector.ModifiedFormPages("General").Controls("ComboBox10").Value
Str6 = Item.GetInspector.ModifiedFormPages("General").Controls("ComboBox3").Value
Str7 = Item.GetInspector.ModifiedFormPages("General").Controls("ComboBox2").Value
Str8 = Item.GetInspector.ModifiedFormPages("General").Controls("ComboBox4").Value
Str9 = Item.GetInspector.ModifiedFormPages("General").Controls("ComboBox5").Value
Str10 = Item.GetInspector.ModifiedFormPages("General").Controls("ContactTypeComboBox1").Value
Str11 = Item.GetInspector.ModifiedFormPages("General").Controls("TextBox4").Value
Str12 = Item.GetInspector.ModifiedFormPages("General").Controls("StatusComboBox1").Value
Str13 = Item.GetInspector.ModifiedFormPages("General").Controls("TextBox20").Value
Str14 = Item.GetInspector.ModifiedFormPages("General").Controls("ComboBox6").Value
Str15 = Item.GetInspector.ModifiedFormPages("General").Controls("TextBox22").Value
Str16 = Item.GetInspector.ModifiedFormPages("General").Controls("ComboBox9").Value
Str17 = Item.GetInspector.ModifiedFormPages("General").Controls("Follow-Up ComboBox1").Value
Str18 = Item.GetInspector.ModifiedFormPages("General").Controls("TextBox3").Value
Str19 = Item.GetInspector.ModifiedFormPages("General").Controls("NextStepComboBox1").Value
StartDate = item.getinspector.modifiedformpages("General").controls("OlkDateControl4").value
DueDate = item.getinspector.modifiedformpages("General").controls("OlkDateControl3").value
ContactName = Item.GetInspector.ModifiedFormPages("General").Controls("Fullname").value
Set olns = Item.Application.GetNameSpace("MAPI")
Set MyFolder = olns.GetDefaultFolder(13)
NumItems = MyFolder.Items.Count
Set myItems = myFolder.Items
If numitems > 0 then
For I = 1 to NumItems
Set Recipients = myItems(I).Recipients
If Recipients.count > 0 then
if myitems(I).Links.Item(1).Name = ContactName Then
MyItems(I).Display
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox20").Value = Str
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox7").Value = Str1
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox24").Value = Str2
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox25").Value = Str3
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox26").Value = Str4
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox23").Value = Str5
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox8").Value = Str6
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox9").Value = Str7
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox10").Value = Str8
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox11").Value = Str9
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox12").Value = Str10
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox13").Value = Str11
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox14").Value = Str12
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox15").Value = Str13
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox16").Value = Str14
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox22").Value = Str15
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox21").Value = Str16
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox17").Value = Str17
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox18").Value = Str18
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox19").Value = Str19
myItems(I).StartDate = StartDate
myItems(I).DueDate = DueDate
MyItems(I).Save
MyItems(I).Close(0)
TaskCount = TaskCount + 1
End If
End If
Next
end if
Select case TaskCount
Case 0
msgbox "No tasks were updated."
Case 1
msgbox "One task was update successfully."
Case Else
msgbox taskcount & " tasks were updated successfully."
End Select
End Sub
Sub With Double spaces Removed. Note that some characheters in OP were not readable
Sub btnUpdateTasks_Click
dim ContactName
dim olns
dim MyFolder
dim NumItems
dim myItems
dim TaskCount
Dim Str,Str1,Str2,Str3,Str4,Str5,Str6,Str7,Str8,Str9,Str10,Str11,Str12,Str13,St r14,Str15,Str16,Str17,Str18,Str19
Dim StartDate
Dim DueDate
Dim Recipients
TaskCount = 0
Str = Item.GetInspector.ModifiedFormPages("General").Controls("ComboBox7").Value
Str1 = Item.GetInspector.ModifiedFormPages("General").Controls("ComboBox8").Value
Str2 = Item.GetInspector.ModifiedFormPages("General").Controls("TextBox5").Value
Str3 = Item.GetInspector.ModifiedFormPages("General").Controls("Initial Intro").Value
Str4 = Item.GetInspector.ModifiedFormPages("General").Controls("Intro Date").Value
Str5 = Item.GetInspector.ModifiedFormPages("General").Controls("ComboBox10").Value
Str6 = Item.GetInspector.ModifiedFormPages("General").Controls("ComboBox3").Value
Str7 = Item.GetInspector.ModifiedFormPages("General").Controls("ComboBox2").Value
Str8 = Item.GetInspector.ModifiedFormPages("General").Controls("ComboBox4").Value
Str9 = Item.GetInspector.ModifiedFormPages("General").Controls("ComboBox5").Value
Str10 = Item.GetInspector.ModifiedFormPages("General").Controls("ContactTypeComboBox1").Value
Str11 = Item.GetInspector.ModifiedFormPages("General").Controls("TextBox4").Value
Str12 = Item.GetInspector.ModifiedFormPages("General").Controls("StatusComboBox1").Value
Str13 = Item.GetInspector.ModifiedFormPages("General").Controls("TextBox20").Value
Str14 = Item.GetInspector.ModifiedFormPages("General").Controls("ComboBox6").Value
Str15 = Item.GetInspector.ModifiedFormPages("General").Controls("TextBox22").Value
Str16 = Item.GetInspector.ModifiedFormPages("General").Controls("ComboBox9").Value
Str17 = Item.GetInspector.ModifiedFormPages("General").Controls("Follow-Up ComboBox1").Value
Str18 = Item.GetInspector.ModifiedFormPages("General").Controls("TextBox3").Value
Str19 = Item.GetInspector.ModifiedFormPages("General").Controls("NextStepComboBox1").Value
StartDate = item.getinspector.modifiedformpages("General").controls("OlkDateControl4").value
DueDate = item.getinspector.modifiedformpages("General").controls("OlkDateControl3").value
ContactName = Item.GetInspector.ModifiedFormPages("General").Controls("Fullname").value
Set olns = Item.Application.GetNameSpace("MAPI")
Set MyFolder = olns.GetDefaultFolder(13)
NumItems = MyFolder.Items.Count
Set myItems = myFolder.Items
If numitems > 0 then
For I = 1 to NumItems
Set Recipients = myItems(I).Recipients
If Recipients.count > 0 then
if myitems(I).Links.Item(1).Name = ContactName Then
MyItems(I).Display
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox20").Value = Str
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox7").Value = Str1
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox24").Value = Str2
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox25").Value = Str3
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox26").Value = Str4
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox23").Value = Str5
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox8").Value = Str6
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox9").Value = Str7
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox10").Value = Str8
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox11").Value = Str9
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox12").Value = Str10
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox13").Value = Str11
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox14").Value = Str12
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox15").Value = Str13
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox16").Value = Str14
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox22").Value = Str15
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox21").Value = Str16
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox17").Value = Str17
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox18").Value = Str18
myItems(I).GetInspector.ModifiedFormPages("P.2").Controls("TextBox19").Value = Str19
myItems(I).StartDate = StartDate
myItems(I).DueDate = DueDate
MyItems(I).Save
MyItems(I).Close(0)
TaskCount = TaskCount + 1
End If
End If
Next
end if
Select case TaskCount
Case 0
msgbox "No tasks were updated."
Case 1
msgbox "One task was update successfully."
Case Else
msgbox taskcount & " tasks were updated successfully."
End Select
End Sub
I don't see any Commandbutton4 code???
I have two codes related to Tasks...the CommandButton4 code creates the task....the one I showed above updates the Task and related fields...and the name of the commandbutton is "btnUpdateTasks" so that's the commandbutton I want to use..
After really looking at your code, I am sorry to have to say, but, except for a small edit to improve efficiency, that code can not be modified in any way unless the Coder is able to actually see the Form in Design mode.
The Reason is that almost none of the controls or String variables have meaningful names. For Example; What is the name of the data used by Str5, CmboBox10 and Textbox23?
For that matter, there are several controls with the same name, although members of different Form objects, that hold different kinds of data.
Post the RemoteCommandButtonClick code you tried. Before Paste it in, click the # button at the top of the Post editor and paste the code in between the two (Bracketed) Code Tags.
Again, I am not the expert re codes....I can just explain that in the form of the contact that each contact is created from, there are many additional fields that have words/dates that can be put in each field. And the other code in the script as commandbutton4, creates a task to the contact and in the form of the Task in the P2 area, there are fields that get the same words/dates from the contact fields. So the code I posted, simply updates the Task regarding that contact based on any changes to the fields in the Contact, and that upgrades the fields in the Task fields.....
Post the RemoteCommandButtonClick code you tried. Before Paste it in, click the # button at the top of the Post editor and paste the code in between the two (Bracketed) Code Tags.
Sub ClickRemoteCommandButton()
Load Contact_Form_1
Contact_Form_1.btnUpdateTasks_Click
Unload Contact_Form_1
End Sub
Are you sure that there are spaces in the name "Contact Form 1"?
Try this
Sub ClickRemoteCommandButton()
Load IPM.Contact.Contact Form 1
IPM.Contact.Contact Form 1.btnUpdateTasks_Click
Unload IPM.Contact.Contact Form 1
End Sub
If that doesn't do something, then I am truly stuck.
I put it in a module....highlighted a contact, ran the macro and the error is:
Compile error
Syntax error
And it colors the the load line
Sorry, my friend, I'm stuck I have asked mrojas to take a look at this thread for you.
I hope you get your answer.
Any answer from someone else please?
How do you open the form manually? Record a Macro and manually open the form. Copy the Macro code and post it. Maybe that can help us understand the what to do.
Thanks...here is the macro that opens up a new contact based on my the form I use.....
Sub OpenMyContact()
Dim oContact As outlook.ContactItem
Dim oFolder As outlook.MAPIFolder
Set oFolder = Application.Session.GetDefaultFolder(olFolderContacts)
Set oContact = oFolder.items.Add("IPM.Contact.Contact Form 1.")
oContact.Display
End Sub
Right.
The next step must be done before we can go any further. And only you can do it.
All the controls on your form must be properly named. There are certain standards for naming Form Controls:
Labels do not need a custom name because they are not referenced in code.
All controls referenced in the code must have a custom name.
No spaces are allowed in Names
The Names must indicate the name of the values of the Controls
All custom names must start with a lower case prefix that indicates the control Type:
cbo = ComboBoxes (cboContacts)
txt = TextBoxes (txtIntroDate)
lbx = ListBoxes (lbxMyFriends)
Open your Form in the VB Editor (VBE) and insure that the Properties window is View-able.
You will see that every TextBox and ComboBox has a Label next to it. These Labels Name the Values of the Input controls. See #4 above.
Following Rules 3, 4, & 5 above, one control at a time, first note the existing name of the Input Control and rename it in the Properties Window. Then View the code of the Form, press Ctrl+H to show the Replace Dialog. Check the boxes "Current Project," "Find Whole Word Only," and "Match Case." Put the old name in the Find What box and the new name in the Replace With box.
Make sure you have the correct spelling of the old and new names. (you can use Ctrl+H to correct mistakes, but....)
Press "Replace All."
Repeat with the next Ctrl that needs a new name.
When you have completed renaming all controls, post the new names code from
Sub btnUpdateTasks_Click so we can doublecheck the Renaming for you.
I have a Userform and a Module related to it, and when I highlight a list of contacts in a folder, I run the Userform, it shows in the top Combobox the list of the fields that I have identified as part of a Contact form related to the Contacts I use, and and in Combobox re Value, it shows the drop list of words or dates that I can use to the specific field, and then when I click on the commandbutton in the Userform, it upgrades the field in all contacts I have highlighted putting in the words or dates that I have decided from the drop list.....
And in the Module which makes this happen as to the User from, there is the separtate words If myValue = "Update Task Fields" Then and below that is the Script code from the Contact that upgrades the Task of the Contact...and in the Userform, where the Case is Case "btnUpdateTasks", and the value below it is Me.ddlValues.addItem "Update Task Fields"
So when I upgrade the field of the Task date, and then run the Value "Update Task Fields", it runs the script and upgrades the Task of the contact I highlighted.....
But what it does not do, is upgrade all contacts that I hightlighed re changing the Task field date.
So is there something to change in the Userform or Module that will updgrade the Tasks of all Contacts I highlight, just how all Contacts are updgraded re the fields of words and dates?
So first below is the Userform code and next is the Module code.
So please let me known what to upgrade re the code or both codes so that it will upgarde the Tasks of all Contacts I highlight, just how all Contacts are updgrade re the fields of words and dates.
Private Sub btnRun_Click()
Dim Field As String
Dim value As String
Field = Me.ddlFields.Text
value = Me.ddlValues.Text
UpdateContactField Field, value
Me.Hide
End Sub
Private Sub ddlFields_Change()
Dim fld As String
fld = Me.ddlFields.Text
'Add your field related values here.
Select Case fld
Case "Initial Intro"
Me.ddlValues.addItem ""
Me.ddlValues.addItem "Words to Add"
Me.ddlValues.addItem "Words to Add"
Case "Intro Date"
Me.ddlValues.addItem "None"
Me.ddlValues.addItem " 9/21/2013 "
Me.ddlValues.addItem " 9/20/2013 "
Me.ddlValues.addItem " 9/21/2013 "
Me.ddlValues.addItem " 9/22/2013 "
Me.ddlValues.addItem " 9/23/2013 "
Me.ddlValues.addItem " 9/24/2013 "
Me.ddlValues.addItem " 9/25/2013 "
Me.ddlValues.addItem " 9/26/2013 "
Me.ddlValues.addItem " 9/27/2013 "
Me.ddlValues.addItem " 9/28/2013 "
Me.ddlValues.addItem " 9/29/2013 "
Me.ddlValues.addItem " 9/30/2013 "
Me.ddlValues.addItem " 10/1/2013 "
Me.ddlValues.addItem " 10/2/2013 "
Me.ddlValues.addItem " 10/3/2013 "
Me.ddlValues.addItem " 10/4/2013 "
Me.ddlValues.addItem " 10/5/2013 "
Me.ddlValues.addItem " 10/6/2013 "
Me.ddlValues.addItem " 10/7/2013 "
Me.ddlValues.addItem " 10/8/2013 "
Me.ddlValues.addItem " 10/9/2013 "
Me.ddlValues.addItem " 10/10/2013 "
Me.ddlValues.addItem " 10/11/2013 "
Me.ddlValues.addItem " 10/12/2013 "
Me.ddlValues.addItem " 10/13/2013 "
Me.ddlValues.addItem " 10/14/2013 "
Case "btnUpdateTasks"
Me.ddlValues.addItem "Update Task Fields"
End Select
End Sub
Private Sub UserForm_Initialize()
'Add your field names here.
Me.ddlFields.addItem "Initial Intro"
Me.ddlFields.addItem "Intro Date"
Me.ddlFields.addItem "btnUpdateTasks"
End Sub
Dim Selected As Integer
X = 1
Set objApp = Application
On Error Resume Next
Select Case TypeName(objApp.ActiveWindow)
Case "Explorer"
For Each item In objApp.ActiveExplorer.Selection
Selected = objApp.ActiveExplorer.Selection.Count
Do While X <= Selected
Set myItem = objApp.ActiveExplorer.Selection.item(X)
myItem.Visible = False
myItem.UserProperties.item(FieldName).value = myValue
If myValue = "Update Task Fields" Then
Dim ContactName
Dim olns
Dim MyFolder
Dim NumItems
Dim myItems
Dim TaskCount
Dim Str, Str1, Str2, Str3, Str4, Str5, Str6, Str7, Str8, Str9, Str10, Str11, Str12, Str13, Str14, Str15, Str16, Str17, Str18, Str19
Dim StartDate
Dim DueDate
Dim Recipients
TaskCount = 0
Str = item.GetInspector.ModifiedFormPages("General").Controls("ComboBox7").value
Str1 = item.GetInspector.ModifiedFormPages("General").Controls("ComboBox8").value
Str2 = item.GetInspector.ModifiedFormPages("General").Controls("TextBox5").value
Str3 = item.GetInspector.ModifiedFormPages("General").Controls("Initial Intro").value
Str4 = item.GetInspector.ModifiedFormPages("General").Controls("Intro Date").value
Str5 = item.GetInspector.ModifiedFormPages("General").Controls("ComboBox10").value
Str6 = item.GetInspector.ModifiedFormPages("General").Controls("ComboBox3").value
Str7 = item.GetInspector.ModifiedFormPages("General").Controls("ComboBox2").value
Str8 = item.GetInspector.ModifiedFormPages("General").Controls("ComboBox4").value
Str9 = item.GetInspector.ModifiedFormPages("General").Controls("ComboBox5").value
Str10 = item.GetInspector.ModifiedFormPages("General").Controls("ContactTypeComboBox1").value
Str11 = item.GetInspector.ModifiedFormPages("General").Controls("TextBox4").value
Str12 = item.GetInspector.ModifiedFormPages("General").Controls("StatusComboBox1").value
Str13 = item.GetInspector.ModifiedFormPages("General").Controls("TextBox20").value
Str14 = item.GetInspector.ModifiedFormPages("General").Controls("ComboBox6").value
Str15 = item.GetInspector.ModifiedFormPages("General").Controls("TextBox22").value
Str16 = item.GetInspector.ModifiedFormPages("General").Controls("ComboBox9").value
Str17 = item.GetInspector.ModifiedFormPages("General").Controls("Follow-Up ComboBox1").value
Str18 = item.GetInspector.ModifiedFormPages("General").Controls("TextBox3").value
Str19 = item.GetInspector.ModifiedFormPages("General").Controls("NextStepComboBox1").value
StartDate = item.GetInspector.ModifiedFormPages("General").Controls("OlkDateControl4").value
DueDate = item.GetInspector.ModifiedFormPages("General").Controls("OlkDateControl3").value
ContactName = item.GetInspector.ModifiedFormPages("General").Controls("Fullname").value
Set olns = item.Application.GetNamespace("MAPI")
Set MyFolder = olns.GetDefaultFolder(13)
NumItems = MyFolder.items.Count
Set myItems = MyFolder.items
If NumItems > 0 Then
For i = 1 To NumItems
Set Recipients = myItems(i).Recipients
If Recipients.Count > 0 Then
If myItems(i).Links.item(1).Name = ContactName Then
myItems(i).Display
myItems(i).GetInspector.ModifiedFormPages("P.2").Controls("TextBox20").value = Str
myItems(i).GetInspector.ModifiedFormPages("P.2").Controls("TextBox7").value = Str1
myItems(i).GetInspector.ModifiedFormPages("P.2").Controls("TextBox24").value = Str2
myItems(i).GetInspector.ModifiedFormPages("P.2").Controls("TextBox25").value = Str3
myItems(i).GetInspector.ModifiedFormPages("P.2").Controls("TextBox26").value = Str4
myItems(i).GetInspector.ModifiedFormPages("P.2").Controls("TextBox23").value = Str5
myItems(i).GetInspector.ModifiedFormPages("P.2").Controls("TextBox8").value = Str6
myItems(i).GetInspector.ModifiedFormPages("P.2").Controls("TextBox9").value = Str7
myItems(i).GetInspector.ModifiedFormPages("P.2").Controls("TextBox10").value = Str8
myItems(i).GetInspector.ModifiedFormPages("P.2").Controls("TextBox11").value = Str9
myItems(i).GetInspector.ModifiedFormPages("P.2").Controls("TextBox12").value = Str10
myItems(i).GetInspector.ModifiedFormPages("P.2").Controls("TextBox13").value = Str11
myItems(i).GetInspector.ModifiedFormPages("P.2").Controls("TextBox14").value = Str12
myItems(i).GetInspector.ModifiedFormPages("P.2").Controls("TextBox15").value = Str13
myItems(i).GetInspector.ModifiedFormPages("P.2").Controls("TextBox16").value = Str14
myItems(i).GetInspector.ModifiedFormPages("P.2").Controls("TextBox22").value = Str15
myItems(i).GetInspector.ModifiedFormPages("P.2").Controls("TextBox21").value = Str16
myItems(i).GetInspector.ModifiedFormPages("P.2").Controls("TextBox17").value = Str17
myItems(i).GetInspector.ModifiedFormPages("P.2").Controls("TextBox18").value = Str18
myItems(i).GetInspector.ModifiedFormPages("P.2").Controls("TextBox19").value = Str19
myItems(i).StartDate = StartDate
myItems(i).DueDate = DueDate
myItems(i).Save
myItems(i).Close (0)
TaskCount = TaskCount + 1
End If
End If
Next
End If
Select Case TaskCount
Case 0
MsgBox "No tasks were updated."
Case 1
MsgBox "One task was update successfully."
Case Else
MsgBox TaskCount & " tasks were updated successfully."
End Select
End If
myItem.Display
myItem.Save
X = X + 1
Loop
Next
End Select
Set objApp = Nothing
End Sub
Ims,
Good-bye and good luck.
SamT
What I showed basically run the commandbuttton from the Contact....so no answers so it affects all contacts I highlight as the field area does that?
And please look at the next question I just posted
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.