Comment peut on faire pour deplacer un objet d'une liste
box a 2 colonne vers une autre ?
ex :
listbox1 listbox2
essai1 choix1
essai2 choix2
essai3 choix3
j'aimerai par drag n drop avoir
listbox1 listbox2
essai1 choix1 essai2 choix2
essai3 choix3
voici le code que j'utilise mais je ne sais pas qu'elle
mofdif il faut faire pour qu'il prenne en compte les deux
colonnes.
merci d'avance
Private Sub ListBox2_BeforeDragOver(ByVal Cancel As _
MSForms.ReturnBoolean, ByVal Data As _
MSForms.DataObject, ByVal X As Single, _
ByVal Y As Single, ByVal DragState As Long, _
ByVal Effect As MSForms.ReturnEffect, _
ByVal Shift As Integer)
Cancel = True
Effect = 1
End Sub
Private Sub ListBox2_BeforeDropOrPaste(ByVal _
Cancel As MSForms.ReturnBoolean, _
ByVal Action As Long, ByVal Data As _
MSForms.DataObject, ByVal X As Single, _
ByVal Y As Single, ByVal Effect As _
MSForms.ReturnEffect, ByVal Shift As Integer)
Cancel = True
Effect = 1
ListBox2.AddItem Data.GetText
End Sub
Private Sub ListBox1_MouseMove(ByVal Button As _
Integer, ByVal Shift As Integer, ByVal X As _
Single, ByVal Y As Single)
Dim MyDataObject As DataObject
If Button = 1 Then
Set MyDataObject = New DataObject
Dim Effect As Integer
MyDataObject.SetText ListBox1.Value
Effect = MyDataObject.StartDrag
End If
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
François Picalausa
Bonjour/soir,
Tu peux essayer ceci: Private Sub ListBox2_BeforeDragOver(ByVal Cancel As MSForms.ReturnBoolean, ByVal Data As MSForms.DataObject, ByVal X As Single, ByVal Y As Single, ByVal DragState As MSForms.fmDragState, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer) Cancel = True Effect = fmDropEffectCopy End Sub
Private Sub ListBox1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) If Button = 1 Then Dim DataObject As DataObject Set DataObject = New DataObject DataObject.StartDrag End If End Sub
Private Sub ListBox2_BeforeDropOrPaste(ByVal Cancel As MSForms.ReturnBoolean, ByVal Action As MSForms.fmAction, ByVal Data As MSForms.DataObject, ByVal X As Single, ByVal Y As Single, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer) Cancel = True ListBox2.AddItem ListBox1.List(ListBox1.ListIndex, 0) ListBox2.Column(1, ListBox2.ListCount - 1) ListBox1.List(ListBox1.ListIndex, 1) End Sub
Private Sub UserForm_Initialize() Dim i As Long
For i = 1 To 50 ListBox1.AddItem "Test" & i ListBox1.Column(1, i - 1) = "Sub" & i Next i End Sub
"Gus" a écrit dans le message de news:072301c3600d$221eefc0$
Comment peut on faire pour deplacer un objet d'une liste box a 2 colonne vers une autre ? ex : listbox1 listbox2 essai1 choix1 essai2 choix2 essai3 choix3
j'aimerai par drag n drop avoir listbox1 listbox2 essai1 choix1 essai2 choix2 essai3 choix3
voici le code que j'utilise mais je ne sais pas qu'elle mofdif il faut faire pour qu'il prenne en compte les deux colonnes. merci d'avance
Private Sub ListBox2_BeforeDragOver(ByVal Cancel As _ MSForms.ReturnBoolean, ByVal Data As _ MSForms.DataObject, ByVal X As Single, _ ByVal Y As Single, ByVal DragState As Long, _ ByVal Effect As MSForms.ReturnEffect, _ ByVal Shift As Integer)
Cancel = True Effect = 1 End Sub
Private Sub ListBox2_BeforeDropOrPaste(ByVal _ Cancel As MSForms.ReturnBoolean, _ ByVal Action As Long, ByVal Data As _ MSForms.DataObject, ByVal X As Single, _ ByVal Y As Single, ByVal Effect As _ MSForms.ReturnEffect, ByVal Shift As Integer) Cancel = True Effect = 1 ListBox2.AddItem Data.GetText End Sub
Private Sub ListBox1_MouseMove(ByVal Button As _ Integer, ByVal Shift As Integer, ByVal X As _ Single, ByVal Y As Single) Dim MyDataObject As DataObject
If Button = 1 Then Set MyDataObject = New DataObject Dim Effect As Integer MyDataObject.SetText ListBox1.Value Effect = MyDataObject.StartDrag End If
End Sub .
Bonjour/soir,
Tu peux essayer ceci:
Private Sub ListBox2_BeforeDragOver(ByVal Cancel As MSForms.ReturnBoolean,
ByVal Data As MSForms.DataObject, ByVal X As Single, ByVal Y As Single,
ByVal DragState As MSForms.fmDragState, ByVal Effect As
MSForms.ReturnEffect, ByVal Shift As Integer)
Cancel = True
Effect = fmDropEffectCopy
End Sub
Private Sub ListBox1_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
If Button = 1 Then
Dim DataObject As DataObject
Set DataObject = New DataObject
DataObject.StartDrag
End If
End Sub
Private Sub ListBox2_BeforeDropOrPaste(ByVal Cancel As
MSForms.ReturnBoolean, ByVal Action As MSForms.fmAction, ByVal Data As
MSForms.DataObject, ByVal X As Single, ByVal Y As Single, ByVal Effect As
MSForms.ReturnEffect, ByVal Shift As Integer)
Cancel = True
ListBox2.AddItem ListBox1.List(ListBox1.ListIndex, 0)
ListBox2.Column(1, ListBox2.ListCount - 1) ListBox1.List(ListBox1.ListIndex, 1)
End Sub
Private Sub UserForm_Initialize()
Dim i As Long
For i = 1 To 50
ListBox1.AddItem "Test" & i
ListBox1.Column(1, i - 1) = "Sub" & i
Next i
End Sub
"Gus" <tessier.guillaume@free.fr> a écrit dans le message de
news:072301c3600d$221eefc0$a401280a@phx.gbl
Comment peut on faire pour deplacer un objet d'une liste
box a 2 colonne vers une autre ?
ex :
listbox1 listbox2
essai1 choix1
essai2 choix2
essai3 choix3
j'aimerai par drag n drop avoir
listbox1 listbox2
essai1 choix1 essai2 choix2
essai3 choix3
voici le code que j'utilise mais je ne sais pas qu'elle
mofdif il faut faire pour qu'il prenne en compte les deux
colonnes.
merci d'avance
Private Sub ListBox2_BeforeDragOver(ByVal Cancel As _
MSForms.ReturnBoolean, ByVal Data As _
MSForms.DataObject, ByVal X As Single, _
ByVal Y As Single, ByVal DragState As Long, _
ByVal Effect As MSForms.ReturnEffect, _
ByVal Shift As Integer)
Cancel = True
Effect = 1
End Sub
Private Sub ListBox2_BeforeDropOrPaste(ByVal _
Cancel As MSForms.ReturnBoolean, _
ByVal Action As Long, ByVal Data As _
MSForms.DataObject, ByVal X As Single, _
ByVal Y As Single, ByVal Effect As _
MSForms.ReturnEffect, ByVal Shift As Integer)
Cancel = True
Effect = 1
ListBox2.AddItem Data.GetText
End Sub
Private Sub ListBox1_MouseMove(ByVal Button As _
Integer, ByVal Shift As Integer, ByVal X As _
Single, ByVal Y As Single)
Dim MyDataObject As DataObject
If Button = 1 Then
Set MyDataObject = New DataObject
Dim Effect As Integer
MyDataObject.SetText ListBox1.Value
Effect = MyDataObject.StartDrag
End If
Tu peux essayer ceci: Private Sub ListBox2_BeforeDragOver(ByVal Cancel As MSForms.ReturnBoolean, ByVal Data As MSForms.DataObject, ByVal X As Single, ByVal Y As Single, ByVal DragState As MSForms.fmDragState, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer) Cancel = True Effect = fmDropEffectCopy End Sub
Private Sub ListBox1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) If Button = 1 Then Dim DataObject As DataObject Set DataObject = New DataObject DataObject.StartDrag End If End Sub
Private Sub ListBox2_BeforeDropOrPaste(ByVal Cancel As MSForms.ReturnBoolean, ByVal Action As MSForms.fmAction, ByVal Data As MSForms.DataObject, ByVal X As Single, ByVal Y As Single, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer) Cancel = True ListBox2.AddItem ListBox1.List(ListBox1.ListIndex, 0) ListBox2.Column(1, ListBox2.ListCount - 1) ListBox1.List(ListBox1.ListIndex, 1) End Sub
Private Sub UserForm_Initialize() Dim i As Long
For i = 1 To 50 ListBox1.AddItem "Test" & i ListBox1.Column(1, i - 1) = "Sub" & i Next i End Sub
"Gus" a écrit dans le message de news:072301c3600d$221eefc0$
Comment peut on faire pour deplacer un objet d'une liste box a 2 colonne vers une autre ? ex : listbox1 listbox2 essai1 choix1 essai2 choix2 essai3 choix3
j'aimerai par drag n drop avoir listbox1 listbox2 essai1 choix1 essai2 choix2 essai3 choix3
voici le code que j'utilise mais je ne sais pas qu'elle mofdif il faut faire pour qu'il prenne en compte les deux colonnes. merci d'avance
Private Sub ListBox2_BeforeDragOver(ByVal Cancel As _ MSForms.ReturnBoolean, ByVal Data As _ MSForms.DataObject, ByVal X As Single, _ ByVal Y As Single, ByVal DragState As Long, _ ByVal Effect As MSForms.ReturnEffect, _ ByVal Shift As Integer)
Cancel = True Effect = 1 End Sub
Private Sub ListBox2_BeforeDropOrPaste(ByVal _ Cancel As MSForms.ReturnBoolean, _ ByVal Action As Long, ByVal Data As _ MSForms.DataObject, ByVal X As Single, _ ByVal Y As Single, ByVal Effect As _ MSForms.ReturnEffect, ByVal Shift As Integer) Cancel = True Effect = 1 ListBox2.AddItem Data.GetText End Sub
Private Sub ListBox1_MouseMove(ByVal Button As _ Integer, ByVal Shift As Integer, ByVal X As _ Single, ByVal Y As Single) Dim MyDataObject As DataObject
If Button = 1 Then Set MyDataObject = New DataObject Dim Effect As Integer MyDataObject.SetText ListBox1.Value Effect = MyDataObject.StartDrag End If
End Sub .
Gus
Merci , c'est la solution que j'ai fini par trouver.
-----Message d'origine----- Bonjour/soir,
Tu peux essayer ceci: Private Sub ListBox2_BeforeDragOver(ByVal Cancel As
MSForms.ReturnBoolean,
ByVal Data As MSForms.DataObject, ByVal X As Single,
ByVal Y As Single,
ByVal DragState As MSForms.fmDragState, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer) Cancel = True Effect = fmDropEffectCopy End Sub
Private Sub ListBox1_MouseMove(ByVal Button As Integer,
ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single) If Button = 1 Then Dim DataObject As DataObject Set DataObject = New DataObject DataObject.StartDrag End If End Sub
Private Sub ListBox2_BeforeDropOrPaste(ByVal Cancel As MSForms.ReturnBoolean, ByVal Action As MSForms.fmAction,
ByVal Data As
MSForms.DataObject, ByVal X As Single, ByVal Y As
Single, ByVal Effect As
MSForms.ReturnEffect, ByVal Shift As Integer) Cancel = True ListBox2.AddItem ListBox1.List(ListBox1.ListIndex, 0) ListBox2.Column(1, ListBox2.ListCount - 1) = ListBox1.List(ListBox1.ListIndex, 1) End Sub
Private Sub UserForm_Initialize() Dim i As Long
For i = 1 To 50 ListBox1.AddItem "Test" & i ListBox1.Column(1, i - 1) = "Sub" & i Next i End Sub
Comment peut on faire pour deplacer un objet d'une
liste
box a 2 colonne vers une autre ? ex : listbox1 listbox2 essai1 choix1 essai2 choix2 essai3 choix3
j'aimerai par drag n drop avoir listbox1 listbox2 essai1 choix1 essai2 choix2 essai3 choix3
voici le code que j'utilise mais je ne sais pas qu'elle mofdif il faut faire pour qu'il prenne en compte les
deux
colonnes. merci d'avance
Private Sub ListBox2_BeforeDragOver(ByVal Cancel As _ MSForms.ReturnBoolean, ByVal Data As _ MSForms.DataObject, ByVal X As Single, _ ByVal Y As Single, ByVal DragState As Long, _ ByVal Effect As MSForms.ReturnEffect, _ ByVal Shift As Integer)
Cancel = True Effect = 1 End Sub
Private Sub ListBox2_BeforeDropOrPaste(ByVal _ Cancel As MSForms.ReturnBoolean, _ ByVal Action As Long, ByVal Data As _ MSForms.DataObject, ByVal X As Single, _ ByVal Y As Single, ByVal Effect As _ MSForms.ReturnEffect, ByVal Shift As Integer) Cancel = True Effect = 1 ListBox2.AddItem Data.GetText End Sub
Private Sub ListBox1_MouseMove(ByVal Button As _ Integer, ByVal Shift As Integer, ByVal X As _ Single, ByVal Y As Single) Dim MyDataObject As DataObject
If Button = 1 Then Set MyDataObject = New DataObject Dim Effect As Integer MyDataObject.SetText ListBox1.Value Effect = MyDataObject.StartDrag End If
End Sub .
.
Merci , c'est la solution que j'ai fini par trouver.
-----Message d'origine-----
Bonjour/soir,
Tu peux essayer ceci:
Private Sub ListBox2_BeforeDragOver(ByVal Cancel As
MSForms.ReturnBoolean,
ByVal Data As MSForms.DataObject, ByVal X As Single,
ByVal Y As Single,
ByVal DragState As MSForms.fmDragState, ByVal Effect As
MSForms.ReturnEffect, ByVal Shift As Integer)
Cancel = True
Effect = fmDropEffectCopy
End Sub
Private Sub ListBox1_MouseMove(ByVal Button As Integer,
ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
If Button = 1 Then
Dim DataObject As DataObject
Set DataObject = New DataObject
DataObject.StartDrag
End If
End Sub
Private Sub ListBox2_BeforeDropOrPaste(ByVal Cancel As
MSForms.ReturnBoolean, ByVal Action As MSForms.fmAction,
ByVal Data As
MSForms.DataObject, ByVal X As Single, ByVal Y As
Single, ByVal Effect As
MSForms.ReturnEffect, ByVal Shift As Integer)
Cancel = True
ListBox2.AddItem ListBox1.List(ListBox1.ListIndex, 0)
ListBox2.Column(1, ListBox2.ListCount - 1) =
ListBox1.List(ListBox1.ListIndex, 1)
End Sub
Private Sub UserForm_Initialize()
Dim i As Long
For i = 1 To 50
ListBox1.AddItem "Test" & i
ListBox1.Column(1, i - 1) = "Sub" & i
Next i
End Sub
Comment peut on faire pour deplacer un objet d'une
liste
box a 2 colonne vers une autre ?
ex :
listbox1 listbox2
essai1 choix1
essai2 choix2
essai3 choix3
j'aimerai par drag n drop avoir
listbox1 listbox2
essai1 choix1 essai2 choix2
essai3 choix3
voici le code que j'utilise mais je ne sais pas qu'elle
mofdif il faut faire pour qu'il prenne en compte les
deux
colonnes.
merci d'avance
Private Sub ListBox2_BeforeDragOver(ByVal Cancel As _
MSForms.ReturnBoolean, ByVal Data As _
MSForms.DataObject, ByVal X As Single, _
ByVal Y As Single, ByVal DragState As Long, _
ByVal Effect As MSForms.ReturnEffect, _
ByVal Shift As Integer)
Cancel = True
Effect = 1
End Sub
Private Sub ListBox2_BeforeDropOrPaste(ByVal _
Cancel As MSForms.ReturnBoolean, _
ByVal Action As Long, ByVal Data As _
MSForms.DataObject, ByVal X As Single, _
ByVal Y As Single, ByVal Effect As _
MSForms.ReturnEffect, ByVal Shift As Integer)
Cancel = True
Effect = 1
ListBox2.AddItem Data.GetText
End Sub
Private Sub ListBox1_MouseMove(ByVal Button As _
Integer, ByVal Shift As Integer, ByVal X As _
Single, ByVal Y As Single)
Dim MyDataObject As DataObject
If Button = 1 Then
Set MyDataObject = New DataObject
Dim Effect As Integer
MyDataObject.SetText ListBox1.Value
Effect = MyDataObject.StartDrag
End If
Merci , c'est la solution que j'ai fini par trouver.
-----Message d'origine----- Bonjour/soir,
Tu peux essayer ceci: Private Sub ListBox2_BeforeDragOver(ByVal Cancel As
MSForms.ReturnBoolean,
ByVal Data As MSForms.DataObject, ByVal X As Single,
ByVal Y As Single,
ByVal DragState As MSForms.fmDragState, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer) Cancel = True Effect = fmDropEffectCopy End Sub
Private Sub ListBox1_MouseMove(ByVal Button As Integer,
ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single) If Button = 1 Then Dim DataObject As DataObject Set DataObject = New DataObject DataObject.StartDrag End If End Sub
Private Sub ListBox2_BeforeDropOrPaste(ByVal Cancel As MSForms.ReturnBoolean, ByVal Action As MSForms.fmAction,
ByVal Data As
MSForms.DataObject, ByVal X As Single, ByVal Y As
Single, ByVal Effect As
MSForms.ReturnEffect, ByVal Shift As Integer) Cancel = True ListBox2.AddItem ListBox1.List(ListBox1.ListIndex, 0) ListBox2.Column(1, ListBox2.ListCount - 1) = ListBox1.List(ListBox1.ListIndex, 1) End Sub
Private Sub UserForm_Initialize() Dim i As Long
For i = 1 To 50 ListBox1.AddItem "Test" & i ListBox1.Column(1, i - 1) = "Sub" & i Next i End Sub
Comment peut on faire pour deplacer un objet d'une
liste
box a 2 colonne vers une autre ? ex : listbox1 listbox2 essai1 choix1 essai2 choix2 essai3 choix3
j'aimerai par drag n drop avoir listbox1 listbox2 essai1 choix1 essai2 choix2 essai3 choix3
voici le code que j'utilise mais je ne sais pas qu'elle mofdif il faut faire pour qu'il prenne en compte les
deux
colonnes. merci d'avance
Private Sub ListBox2_BeforeDragOver(ByVal Cancel As _ MSForms.ReturnBoolean, ByVal Data As _ MSForms.DataObject, ByVal X As Single, _ ByVal Y As Single, ByVal DragState As Long, _ ByVal Effect As MSForms.ReturnEffect, _ ByVal Shift As Integer)
Cancel = True Effect = 1 End Sub
Private Sub ListBox2_BeforeDropOrPaste(ByVal _ Cancel As MSForms.ReturnBoolean, _ ByVal Action As Long, ByVal Data As _ MSForms.DataObject, ByVal X As Single, _ ByVal Y As Single, ByVal Effect As _ MSForms.ReturnEffect, ByVal Shift As Integer) Cancel = True Effect = 1 ListBox2.AddItem Data.GetText End Sub
Private Sub ListBox1_MouseMove(ByVal Button As _ Integer, ByVal Shift As Integer, ByVal X As _ Single, ByVal Y As Single) Dim MyDataObject As DataObject
If Button = 1 Then Set MyDataObject = New DataObject Dim Effect As Integer MyDataObject.SetText ListBox1.Value Effect = MyDataObject.StartDrag End If
End Sub .
.
Gus
Merci , c'est la solution que j'ai fini par trouver.
-----Message d'origine----- Bonjour/soir,
Tu peux essayer ceci: Private Sub ListBox2_BeforeDragOver(ByVal Cancel As
MSForms.ReturnBoolean,
ByVal Data As MSForms.DataObject, ByVal X As Single,
ByVal Y As Single,
ByVal DragState As MSForms.fmDragState, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer) Cancel = True Effect = fmDropEffectCopy End Sub
Private Sub ListBox1_MouseMove(ByVal Button As Integer,
ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single) If Button = 1 Then Dim DataObject As DataObject Set DataObject = New DataObject DataObject.StartDrag End If End Sub
Private Sub ListBox2_BeforeDropOrPaste(ByVal Cancel As MSForms.ReturnBoolean, ByVal Action As MSForms.fmAction,
ByVal Data As
MSForms.DataObject, ByVal X As Single, ByVal Y As
Single, ByVal Effect As
MSForms.ReturnEffect, ByVal Shift As Integer) Cancel = True ListBox2.AddItem ListBox1.List(ListBox1.ListIndex, 0) ListBox2.Column(1, ListBox2.ListCount - 1) = ListBox1.List(ListBox1.ListIndex, 1) End Sub
Private Sub UserForm_Initialize() Dim i As Long
For i = 1 To 50 ListBox1.AddItem "Test" & i ListBox1.Column(1, i - 1) = "Sub" & i Next i End Sub
Comment peut on faire pour deplacer un objet d'une
liste
box a 2 colonne vers une autre ? ex : listbox1 listbox2 essai1 choix1 essai2 choix2 essai3 choix3
j'aimerai par drag n drop avoir listbox1 listbox2 essai1 choix1 essai2 choix2 essai3 choix3
voici le code que j'utilise mais je ne sais pas qu'elle mofdif il faut faire pour qu'il prenne en compte les
deux
colonnes. merci d'avance
Private Sub ListBox2_BeforeDragOver(ByVal Cancel As _ MSForms.ReturnBoolean, ByVal Data As _ MSForms.DataObject, ByVal X As Single, _ ByVal Y As Single, ByVal DragState As Long, _ ByVal Effect As MSForms.ReturnEffect, _ ByVal Shift As Integer)
Cancel = True Effect = 1 End Sub
Private Sub ListBox2_BeforeDropOrPaste(ByVal _ Cancel As MSForms.ReturnBoolean, _ ByVal Action As Long, ByVal Data As _ MSForms.DataObject, ByVal X As Single, _ ByVal Y As Single, ByVal Effect As _ MSForms.ReturnEffect, ByVal Shift As Integer) Cancel = True Effect = 1 ListBox2.AddItem Data.GetText End Sub
Private Sub ListBox1_MouseMove(ByVal Button As _ Integer, ByVal Shift As Integer, ByVal X As _ Single, ByVal Y As Single) Dim MyDataObject As DataObject
If Button = 1 Then Set MyDataObject = New DataObject Dim Effect As Integer MyDataObject.SetText ListBox1.Value Effect = MyDataObject.StartDrag End If
End Sub .
.
Merci , c'est la solution que j'ai fini par trouver.
-----Message d'origine-----
Bonjour/soir,
Tu peux essayer ceci:
Private Sub ListBox2_BeforeDragOver(ByVal Cancel As
MSForms.ReturnBoolean,
ByVal Data As MSForms.DataObject, ByVal X As Single,
ByVal Y As Single,
ByVal DragState As MSForms.fmDragState, ByVal Effect As
MSForms.ReturnEffect, ByVal Shift As Integer)
Cancel = True
Effect = fmDropEffectCopy
End Sub
Private Sub ListBox1_MouseMove(ByVal Button As Integer,
ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
If Button = 1 Then
Dim DataObject As DataObject
Set DataObject = New DataObject
DataObject.StartDrag
End If
End Sub
Private Sub ListBox2_BeforeDropOrPaste(ByVal Cancel As
MSForms.ReturnBoolean, ByVal Action As MSForms.fmAction,
ByVal Data As
MSForms.DataObject, ByVal X As Single, ByVal Y As
Single, ByVal Effect As
MSForms.ReturnEffect, ByVal Shift As Integer)
Cancel = True
ListBox2.AddItem ListBox1.List(ListBox1.ListIndex, 0)
ListBox2.Column(1, ListBox2.ListCount - 1) =
ListBox1.List(ListBox1.ListIndex, 1)
End Sub
Private Sub UserForm_Initialize()
Dim i As Long
For i = 1 To 50
ListBox1.AddItem "Test" & i
ListBox1.Column(1, i - 1) = "Sub" & i
Next i
End Sub
Comment peut on faire pour deplacer un objet d'une
liste
box a 2 colonne vers une autre ?
ex :
listbox1 listbox2
essai1 choix1
essai2 choix2
essai3 choix3
j'aimerai par drag n drop avoir
listbox1 listbox2
essai1 choix1 essai2 choix2
essai3 choix3
voici le code que j'utilise mais je ne sais pas qu'elle
mofdif il faut faire pour qu'il prenne en compte les
deux
colonnes.
merci d'avance
Private Sub ListBox2_BeforeDragOver(ByVal Cancel As _
MSForms.ReturnBoolean, ByVal Data As _
MSForms.DataObject, ByVal X As Single, _
ByVal Y As Single, ByVal DragState As Long, _
ByVal Effect As MSForms.ReturnEffect, _
ByVal Shift As Integer)
Cancel = True
Effect = 1
End Sub
Private Sub ListBox2_BeforeDropOrPaste(ByVal _
Cancel As MSForms.ReturnBoolean, _
ByVal Action As Long, ByVal Data As _
MSForms.DataObject, ByVal X As Single, _
ByVal Y As Single, ByVal Effect As _
MSForms.ReturnEffect, ByVal Shift As Integer)
Cancel = True
Effect = 1
ListBox2.AddItem Data.GetText
End Sub
Private Sub ListBox1_MouseMove(ByVal Button As _
Integer, ByVal Shift As Integer, ByVal X As _
Single, ByVal Y As Single)
Dim MyDataObject As DataObject
If Button = 1 Then
Set MyDataObject = New DataObject
Dim Effect As Integer
MyDataObject.SetText ListBox1.Value
Effect = MyDataObject.StartDrag
End If
Merci , c'est la solution que j'ai fini par trouver.
-----Message d'origine----- Bonjour/soir,
Tu peux essayer ceci: Private Sub ListBox2_BeforeDragOver(ByVal Cancel As
MSForms.ReturnBoolean,
ByVal Data As MSForms.DataObject, ByVal X As Single,
ByVal Y As Single,
ByVal DragState As MSForms.fmDragState, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer) Cancel = True Effect = fmDropEffectCopy End Sub
Private Sub ListBox1_MouseMove(ByVal Button As Integer,
ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single) If Button = 1 Then Dim DataObject As DataObject Set DataObject = New DataObject DataObject.StartDrag End If End Sub
Private Sub ListBox2_BeforeDropOrPaste(ByVal Cancel As MSForms.ReturnBoolean, ByVal Action As MSForms.fmAction,
ByVal Data As
MSForms.DataObject, ByVal X As Single, ByVal Y As
Single, ByVal Effect As
MSForms.ReturnEffect, ByVal Shift As Integer) Cancel = True ListBox2.AddItem ListBox1.List(ListBox1.ListIndex, 0) ListBox2.Column(1, ListBox2.ListCount - 1) = ListBox1.List(ListBox1.ListIndex, 1) End Sub
Private Sub UserForm_Initialize() Dim i As Long
For i = 1 To 50 ListBox1.AddItem "Test" & i ListBox1.Column(1, i - 1) = "Sub" & i Next i End Sub
Comment peut on faire pour deplacer un objet d'une
liste
box a 2 colonne vers une autre ? ex : listbox1 listbox2 essai1 choix1 essai2 choix2 essai3 choix3
j'aimerai par drag n drop avoir listbox1 listbox2 essai1 choix1 essai2 choix2 essai3 choix3
voici le code que j'utilise mais je ne sais pas qu'elle mofdif il faut faire pour qu'il prenne en compte les
deux
colonnes. merci d'avance
Private Sub ListBox2_BeforeDragOver(ByVal Cancel As _ MSForms.ReturnBoolean, ByVal Data As _ MSForms.DataObject, ByVal X As Single, _ ByVal Y As Single, ByVal DragState As Long, _ ByVal Effect As MSForms.ReturnEffect, _ ByVal Shift As Integer)
Cancel = True Effect = 1 End Sub
Private Sub ListBox2_BeforeDropOrPaste(ByVal _ Cancel As MSForms.ReturnBoolean, _ ByVal Action As Long, ByVal Data As _ MSForms.DataObject, ByVal X As Single, _ ByVal Y As Single, ByVal Effect As _ MSForms.ReturnEffect, ByVal Shift As Integer) Cancel = True Effect = 1 ListBox2.AddItem Data.GetText End Sub
Private Sub ListBox1_MouseMove(ByVal Button As _ Integer, ByVal Shift As Integer, ByVal X As _ Single, ByVal Y As Single) Dim MyDataObject As DataObject
If Button = 1 Then Set MyDataObject = New DataObject Dim Effect As Integer MyDataObject.SetText ListBox1.Value Effect = MyDataObject.StartDrag End If