Why will this code just change subject to only the fist selecteditem?
This was not the whole code....
Dim myOlApp As New Outlook.Application
Dim myOlExp As Outlook.Explorer
Dim myOlSel As Outlook.Selection
Dim strProsjektnrnavn, strProsjektnrnavnDel1,
strProsjektnrnavnDel2 As String
Dim x As Integer
Set myOlExp = myOlApp.ActiveExplorer
Set myOlSel = myOlExp.Selection
On Error Resume Next
strProsjektnrnavnDel1 = ""
strProsjektnrnavnDel2 = ""
'sjekker hva som er valgt i listeboksene i UserForm1
strProsjektnrnavnDel1 = ListBox1.Value
strProsjektnrnavnDel2 = ListBox2.Value
If CheckBox3 = True And CheckBox1 = True Then strProsjektnrnavn =
"[" & strProsjektnrnavnDel1 & "] " & "[" & strProsjektnrnavnDel2 & "]
"
If CheckBox3 = True And CheckBox1 = False Then strProsjektnrnavn =
"[" & strProsjektnrnavnDel1 & "] "
If CheckBox3 = False And CheckBox1 = True Then strProsjektnrnavn =
"[" & strProsjektnrnavnDel2 & "] "
If CheckBox3 = False And CheckBox1 = False Then strProsjektnrnavn
= ""
'Stop
'Her blir det satt inn en prefix i emnefeltet og lagt inn kategori
hvis checkboks2 = true
For x = 1 To myOlSel.Count
Emne = myOlSel.Item(x).Subject
'myOlSel.Item(x).Subject = strProsjektnrnavn &
myOlSel.Item(x).Subject 'legger inn prefix i emne
myOlSel.Item(x).Subject = strProsjektnrnavn & Emne 'legger inn
prefix i emne
If CheckBox2 = True Then myOlSel.Item(x).Categories =
strProsjektnrnavnDel2 'legger inn kategori
If CheckBox4 = True Then myOlSel.Item(x).UnRead = False
'marker som lest
Next x
|