How to Copy Multi Select Listbox Data to Appointment

Status
Not open for further replies.

George Z

New Member
Outlook version
Outlook 2013 64 bit
Email Account
Exchange Server
With the help of various tutorials in this form I am trying to combine input data from several different input types into an outlook appointment item. With your assistance I have been able to include data from both message boxes and list boxes. How do you also include multiple selections from a multi select list box? I have been able to capture the selections in an array and display them in a message box. Though have not been able to copy the array data into the appointment subject. I have attached both the custom form code, and the macro code. I am at the point where I am unable to identify where to go from here. As always, any assistance is greatly appreciated. I am not sure if I am way off on this or close to a solution.
 

Attachments

  • Form Code.txt
    2.8 KB · Views: 291
  • MacroCode.txt
    5.3 KB · Views: 310

George Z

New Member
Outlook version
Outlook 2013 64 bit
Email Account
Exchange Server
Not sure how to apply this as you are stating. I am joining the array and displaying as message. I need the join to be included in the subject with data from other sources. Below is code for the Form. I bolded the lst reference also bolded line from macro code adding data to subject. How do I reference the array in the macro code? I separated my form and macro code in original post. . With the code below array I get type mismatch error. Thanks again for your continued support. Appreciate all the feedback.

Private Sub ComboBox2_Change()

End Sub


Private Sub UserForm_Initialize()
With ComboBox1
.AddItem "INSP"
.AddItem "PM"
.AddItem "LOAD TEST"
.AddItem "OR"

End With

With ComboBox2
.AddItem "ANNUAL"
.AddItem "SEMI-ANNUAL"
.AddItem "QUARTERLY"
.AddItem "MONTHLY"
.AddItem "ADHOC INSP/PM"
.AddItem "OR"

End With

With ComboBox3
.AddItem "BEATON 19FT"
.AddItem "BEATON 28FT"
.AddItem "BEATON 32FT"
.AddItem "RENTAL"
.AddItem "CUSTOMER PROVIDED"
.AddItem "NOT REQUIRED"

End With

With ListBox1
.AddItem "BRIDGE CRANE"
.AddItem "GANTRY CRANE"
.AddItem "JIB CRANE"
.AddItem "MONORAIL CRANE"
.AddItem "POWERED HOIST"
.AddItem "CHAINFALL HOIST"
.AddItem "POWERED HOIST"
.AddItem "BELOW HOOK DEVICE"
.AddItem "WINCH"

End With

With ListBox2
.AddItem "OVERHEAD DOOR"
.AddItem "SPEED DOOR"
.AddItem "COILING STEEL DOOR"
.AddItem "IMPACT DOOR"

End With

With ListBox3
.AddItem "VEHICLE LIFT"
.AddItem "ENGINE LIFT"
.AddItem "MATERIAL LIFT"
.AddItem "PALLET JACK"
.AddItem "JACK STAND"
.AddItem "MATERIAL LIFT TABLE"
.AddItem "WALKIE STACKER"
.AddItem "STRAPPING/BANDING MACHINE"

End With

With ListBox4
.AddItem "BOOM ATTACHMENT"

End With

With ListBox5
.AddItem "AUTO SCRUBBER"

End With

With ListBox6
.AddItem "DOCK LEVELER"

End With

With ListBox7
.AddItem "BAILER/COMPACTOR"

End With

With ListBox8
.AddItem "VRC"
.AddItem "SELF RETRACTING LIFE LINE"
.AddItem "TRIPOD"
.AddItem "HORIZONTAL LIFE LINE"

End With

With ListBox9
.AddItem "TRUCK RESTRAINTS"

End With

With ListBox10
.AddItem "METAL MESH SLINGS"
.AddItem "SYNTHETIC ROUND SLING"
.AddItem "SYNTHETIC WEBBING SLING"
.AddItem "WIRE ROPE SLING"
.AddItem "ALLOY STEEL CHAIN SLING"

End With
End Sub


Private Sub CommandButton1_Click()

Dim I As Long
Dim J As Long
Dim msg As String
Dim arrItems() As String

ReDim arrItems(0 To ListBox1.ColumnCount - 1)
For J = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(J) Then

For I = 0 To ListBox1.ColumnCount - 1
arrItems(I) = ListBox1.Column(I, J)
Next I
msg = msg & Join(arrItems, ",") & vbCrLf & vbCrLf


End If
Next J
MsgBox msg


lstNo = ComboBox1.ListIndex
lstNo2 = ComboBox2.ListIndex
lstNo3 = ComboBox3.ListIndex
'lstNo4 = ListBox1.Selected(I)
lstNo4 = Join(arrItems, ",")

' lstNo5 = ListBox2.ListIndex
' lstNo6 = ListBox3.ListIndex
' lstNo7 = ListBox4.ListIndex
' lstNo8 = ListBox5.ListIndex
' lstNo9 = ListBox6.ListIndex
' lstNo10 = ListBox7.ListIndex
' lstNo11 = ListBox8.ListIndex
' lstNo12 = ListBox9.ListIndex
' lstNo13 = ListBox10.ListIndex
Unload Me
End Sub


Here is my line from macro

If objContact.CompanyName <> "" Then
objAppt.Subject = objContact.CompanyName & ", - INSP/PM - ," & inputdata & " , " & strBody1 & strBody2 & strBody3 & inputdata1 & "," & strBody
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
You do have the values of the array in the lstNo4 variable, don´t you? Just add it to the subject as you already do with the other variables.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
A Cannot copy this folder because it may contain private items Using Outlook 0
C Copy Move item won't work Outlook VBA and Custom Forms 2
B VBA to convert email to task, insert text of email in task notes, and attach copy of original email Outlook VBA and Custom Forms 4
Commodore Move turns into "copy" Using Outlook 3
C Copy Outlook contact field value to another field Outlook VBA and Custom Forms 1
J Copy to calendar function no longer working in outlook 365 Using Outlook 5
F Copy and replace not update contact in another pst Using Outlook 0
B Outlook Business Contact Manager with SQL to Excel, User Defined Fields in BCM don't sync in SQL. Can I use VBA code to copy 1 field to another? BCM (Business Contact Manager) 0
Commodore Folders always closed in move/copy items dialog box Using Outlook 3
N Outlook rules don't create a copy for bcc'ed emails Using Outlook 3
geofferyh Outlook 2010 How to Copy Outlook Attachment to a Specific Folder? Outlook VBA and Custom Forms 3
S Custom Form, copy user field data to message body Outlook VBA and Custom Forms 12
R Copy Outlook Public Folders to a File Server Shared Folder Using Outlook 0
K Outlook Rules: Move a Copy Using Outlook 4
oliv- HOW TO COPY /USE FOLDERS ICONS Outlook VBA and Custom Forms 2
E Copy e-mail body from outlook and insert into excel Outlook VBA and Custom Forms 3
B Copy/Move Exchange inbox to Pop inbox Using Outlook 4
R Sending email copy (*.msg file) of sent email if subject line contains specific string. Outlook VBA and Custom Forms 1
O Copy mails from many subfolders to 1 foldr Using Outlook 2
K ind specific Subject line from outlook and copy the content of the email body to exce Outlook VBA and Custom Forms 0
K How to find specific header and copy the mail body Using Outlook 0
J Copy or Export Outlook Mail to Excel Outlook VBA and Custom Forms 6
G Copy Contact field to Appointment Custom Form Field Outlook VBA and Custom Forms 2
Carrie Dickey Outlook 2016 created two calendars titled Calendar1 - appear to be a copy Using Outlook 2
P How to copy and append data from Outlook 2016 message into Excel 2016 workbook Using Outlook 0
Stilgar Relsik Create a rule to copy text from an email and paste it in the subject line. Using Outlook 1
R Macro to copy email to excel - Runtime Error 91 Object Variable Not Set Outlook VBA and Custom Forms 11
H Macro to Copy Specific content from Mail Body and Paste to Excel Outlook VBA and Custom Forms 4
M How to keep reccurence during copy tasks to calendar? Using Outlook 1
Diane Poremsky Copy New Appointments to Another Calendar using VBA New Slipstick.com Articles 0
Diane Poremsky Use a macro to copy data in Outlook email to Excel workbook New Slipstick.com Articles 0
C Copy Task to Non-Microsoft PIM "Rainlendar" Using Outlook 0
G VBA Copy draft email to a new email - attachments not copided Using Outlook 7
C Copy email to excel runtime error 5020 Using Outlook 5
I Copy email from folder to folder - FAILS Using Outlook 5
M Copy new appointments created in multiple shared calendars to another exchange calendar Outlook VBA and Custom Forms 1
Q Why can't I copy image with embedded hyperlink from email to Word Using Outlook 0
I How to make a copy of a task Using Outlook 8
F copy data in Custom Field to other folder Outlook VBA and Custom Forms 2
A Outlook: copy & paste Outlook VBA and Custom Forms 9
V Copy and paste body and subject and send multiple emails Outlook VBA and Custom Forms 3
Diane Poremsky Use a macro to copy data in Outlook email to Excel workbook New Slipstick.com Articles 0
joflo copy contents from outlook to excell - please help. Using Outlook 4
L Copy email body fields to excel Using Outlook 0
G outlook 13 copy & paste without losing formatting Using Outlook 1
C Copy Cell value from Excel and paste into current email Outlook VBA and Custom Forms 10
C How to copy same text header to multiple emails with custom text column Using Outlook 10
T Macro to find contacts by category and copy them to another folder Outlook VBA and Custom Forms 15
A Macro to Copy Data from Outlook to Excel Spreadsheet Using Outlook 2
D How to copy yahoo email folders to hard drive Using Outlook 2

Similar threads

Top