Here is the update with the following userform2 code and the Module8 Code: userform1 works fine....and under userform 2 and Module8, the droplist does not show up
Private Sub ComboBox1_Change()
End Sub
Private Sub ComboBox8_Change()
End Sub
Private Sub UserForm2_Initialize()
With ComboBox8
.AddItem "Today-Meeting_Thank-You_Friend"
.AddItem "Recent-Meeting_Thank-You_Friend"
.AddItem "Recent-Meeting_Thank-You_Network_Contact"
.AddItem "Today_Meeting_Thank-You_Network_Contact"
End With
End Sub
Private Sub CommandButton5_Click()
lstNum2 = ComboBox8.ListIndex
Unload Me
End Sub
Private Sub UserForm_Click()
End Sub
Public lstNum2 As Long
Public Sub ChooseTemplate2()
Dim oMail As Outlook.MailItem
Dim oContact As Outlook.ContactItem
If TypeName(ActiveExplorer.Selection.Item(1)) = "ContactItem" Then
Set oContact = GetCurrentItem()
Dim strTemplate As String
UserForm2.Show
Select Case lstNum2
Case -1
strTemplate = ("C:\Users\Stoler Law\AppData\Roaming\Microsoft\Templates\E-mail From Lou Stoler.oft")
Case 0
strTemplate = ("C:\Users\Stoler Law\AppData\Roaming\Microsoft\Templates\E-mail From Lou Stoler - Today Meeting Thank-You - Friend.oft")
Case 1
strTemplate = ("C:\Users\Stoler Law\AppData\Roaming\Microsoft\Templates\E-mail From Lou Stoler - Recent Meeting Thank-You - Friend.oft")
Case 2
strTemplate = ("C:\Users\Stoler Law\AppData\Roaming\Microsoft\Templates\E-mail From Lou Stoler - Recent Meeting Thank-You - Network Contact.oft")
Case 3
strTemplate = ("C:\Users\Stoler Law\AppData\Roaming\Microsoft\Templates\E-mail From Lou Stoler - Today Meeting Thank-You - Network Contact.oft")
End Select
Set oMail = Application.CreateItemFromTemplate(strTemplate)
With oMail
.To = oContact.Email1Address
.Display
End With
End If
Set oMail = Nothing
End Sub
Function GetCurrentItem() As Object
Dim objApp As Outlook.Application
Set objApp = Application
On Error Resume Next
Select Case TypeName(objApp.ActiveWindow)
Case "Explorer"
Set GetCurrentItem = objApp.ActiveExplorer.Selection.Item(1)
Case "Inspector"
Set GetCurrentItem = objApp.ActiveInspector.CurrentItem
End Select
With ComboBox8
.AddItem "Today-Meeting_Thank-You_Friend"
.AddItem "Recent-Meeting_Thank-You_Friend"
.AddItem "Recent-Meeting_Thank-You_Network_Contact"
.AddItem "Today_Meeting_Thank-You_Network_Contact"
End With
End Sub
Private Sub CommandButton5_Click()
lstNum2 = ComboBox8.ListIndex
Unload Me
End Sub
Private Sub UserForm_Click()
End Sub
the private sub shows up twice...one with ComboBox1 and the other with ComboBox8.......
Do I change the private sub with ComboBox1 to ComboBox8 or just delete it?
With ComboBox7
.AddItem "From_Lou_Stoler"
.AddItem "From_Lou_Stoler_and_Vcard"
.AddItem "Good_Morning_Catch_Up"
.AddItem "Good_Afternoon_Catch_Up"
.AddItem "Good_Morning_Catch_Up_to_Client"
.AddItem "Good_Afternoon_Catch_Up_to_Client"
.AddItem "Today_Meeting_Thank_You_Friend"
.AddItem "Recent_Meeting_Thank_You_Friend"
End With
End Sub
Private Sub CommandButton4_Click()
lstNum = ComboBox7.ListIndex
Unload Me
End Sub
and I have the one for combox8 the following:
Private Sub ComboBox1_Change()
End Sub
Private Sub ComboBox8_Change()
End Sub
Private Sub UserForm2_Initialize()
With ComboBox8
.AddItem "Today-Meeting_Thank-You_Friend"
.AddItem "Recent-Meeting_Thank-You_Friend"
.AddItem "Recent-Meeting_Thank-You_Network_Contact"
.AddItem "Today_Meeting_Thank-You_Network_Contact"
End With
End Sub
Private Sub CommandButton5_Click()
lstNum = ComboBox8.ListIndex
Unload Me
End Sub
Private Sub UserForm_Click()
End Sub
which automatically includes
Private Sub UserForm_Click()
End Sub
so please review the foregoing and let me know as it still want show the droplis in combobox8
Delete those empty subs - Outlook creates them automatically when you click on the form. If there is nothing between the Sub / End sub, it's just taking up space.
Well, that took 3 times longer to pick out the problem than it should have - it needs to be "Private Sub UserForm_Initialize()" - this doesn't get numbered to match the form name.
they'll get added back when you click on the form - if they come back don't worry about it, but remove any empty ones when you paste code from another userform to reduce confusion.
You did it again. You are the best!!! It's working!!!
So if you can, just post a list of the things I change for each new userform and related combox......and then I will have the list of what to do each time.
'
This is perfect, as everyone in the past said there was not way to create a droplist inside the contact.....and now it is done!!
Technically, its not inside the contact. It's just a macro - and a pretty good way of bringing up templates.
Everything in bold needs updated in new macro
user form:
Private Sub UserForm_Initialize()
With ComboBox8
> AddItem "a"
.AddItem "b"
End With
End Sub
Private Sub CommandButton5_Click()
lstNum = ComboBox8.ListIndex
Unload Me
End Sub
macro:
Public lstNum As Long
Public Sub ChooseTemplate()
Dim oMail As Outlook.MailItem
Dim oContact As Outlook.ContactItem
If TypeName(ActiveExplorer.Selection.Item(1)) = "ContactItem" Then
Set oContact = ActiveExplorer.Selection.Item(1)
Dim strTemplate As String UserForm.Show
Select Case lstNum
Case -1
strTemplate = "default"
Case 0
strTemplate = "a"
Case 1
strTemplate = "b"
End Select
Set oMail = Application.CreateItemFromTemplate(strTemplate)
It is now working perfectly and I created 4 different userforms and modules to them....and then added each macro to the Quick Access Tool Bar, and have the bullet points in the Contacts to open the droplists thru the macros!
Once again, I so appreciate your great and fast support!!
hi...believe it or not, I did it again....with userform6 and module 12......it is command button 9 and combobox12....I changes all of those areas re exactly what you showed me to do...and the debug comes in the module that "UserForm6.Show" is in yellow....
That usually means it can't find the userform to show. Triple check the name of the form. If the problem was with the button and box #, it wouldn't do anything or those drop downs would be empty.
When I click on it in the userform the words come up:
Userform6 = <Object variable or With block variable notset
So what should I do please?
- - - Updated - - -
also, before I put this together, I had created a first userform6 and deleted it and not exported it as i thought earlier I didn't need another one....and then I created the userform6 as a new useform after I deleted the earlier one.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.