Moving Items Between Listboxes
Hey...
Could someone please provide me with the syntax for moving items in between two listboxes (i.e. List1 and List2)?
I'm having some trouble fiddling about with it. I simple want to be able to add items from List1 to List2 (deleting the item from List1 in the process) and vice versa.
Thanking you in advance...
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Moving Items Together From Two Listboxes!
i have two lists!
list 1 list2
math sci
history soc
math sci
drawing fun
physics sci
biology sci
phys.eductaion fun
list1 has the subjects
list2 has the category of the subjects
now i can arrange the second list so that sci goes first then soc then fun
(i have the code for this) but the problem is that together with the category also the subject should move.
so i want them to move together when being sorted!
is there any way to keep them together!
i have done something with listindex and topindex but it is not functional for this case!
Moving Items Between Listboxes
I'm having trouble figuring out how to move a list from one listbox to
another using a command button. The idea is to click on a command
button and all items in listbox A will move over to listbox B. I'm
able to move one item using AddItem, but I don't know how to move the
whole list.
Thank you.
Moving Items Between Listboxes
Hello,
I have a form with 2 listboxes (lstUnselected & lstSelected). I want to let the user send as many items as they have highlighted from 'lstUnselected' to 'lstSelected' with the click of a button. The items will then disappear from 'lstUnselected' and appear on 'lstSelected.'
How does this work?
Much thanks!
Ed
Moving Items From Listboxes To Table
I want to move rows with items from listboxes to a table. Each listbox is a collumn of items, and I want all items to be moved to the database table one row at a time, and remove the rows from the listboxes when they have been added to the database. I figure I need loop function for this, but I dont have much experience with them.
I tried running the codes bellow, but I get invalid use of property or something at "kategoriliste.ListIndex = fisknummer" etc.
I also have a problem with the insert function to the database, it's giving me "missing operator in query". I tried copying an insert function from another post on this forum and changed it for my needs, but it didnt work any better.
Code:
Public Sub OppdaterIndivider()
Dim MyConn As ADODB.Connection
Set MyConn = New ADODB.Connection
Dim MyRecSet As ADODB.Recordset
Dim alder As String
Dim kjoenn As String
Dim arten As String
Dim kategori As String
For fisknummer = 0 To kategoriliste.ListCount
kategoriliste.ListIndex = fisknummer
familien.ListIndex = fisknummer
populær.ListIndex = fisknummer
kjønn.ListIndex = fisknummer
pris.ListIndex = fisknummer
kategori = kategoriliste.Text
arten = familien.Text
alder = 6
kjoenn = kjønn.Text
Set MyConn = New ADODB.Connection
MyConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:ProgrammeringAkvariespilletAkvariespillet.mdb;"
MyConn.Open
With MyConn
.BeginTrans
.Execute "INSERT INTO Individermaller (artsnavn, alder_mnd, kjønn) VALUES('" & arten & "', #" & alder & "', #" & kjoenn & "#)"
.CommitTrans
End With
Next fisknummer
kategoriliste.clear
familien.clear
populær.clear
kjønn.clear
pris.clear
End Sub
So, can you tell me why the loop and the insert functions aren't working?
Moving Items Between Listboxes (RESOLVED)
Hi, all
I am trying to do simple moving items between Listoxes I have a lbxAll that is populated with all items and lbxSelected that is to contain the selected items. I need a functionality that user will be able to select more than one item and at the push of a button these items will be transfered to the other listbox and removed from lbxAll
This is my code
Code:
'# to loop over all irems
Dim i As Integer
For i = 0 To lbxAll.Items.Count - 1
'# if current item is selected copy it to lbxSelected
If lbxAll.GetSelected(i) = True Then
lbxSelected.Items.Add(lbxAll.Items.Item(i))
End If
Next
Dim j As Integer
For j = lbxAll.Items.Count - 1 To 0 Step -1
'# if current item is selected copy it to lbxSelected
If lbxAll.GetSelected(j) = True Then
lbxSelected.Items.Remove(lbxSelected.Items.Item(j))
End If
Next
The first loop works OK items are copied into lbxSelected But I am always getting error when a Item is to be removed I think this is because once the item has been removed the whole index of lbxAll will change... But Is there any way of doing this?
--------------------------------------------------------------------------------
<Signature>
That boy is our last hope.......................................
No there is another !
</Signature>
Edited by - pajer on 9/13/2004 4:33:57 AM
Moving Items Between Listboxes Using "instr, Right And Left" Functions
Pls help........
I need help using instr, right , and left functions.
I got 3 list boxes, 1 called lstProduct, 1 called lstPrice and 1 called lstTrolley.
When I dbl click on any item in Product or Price it moves the selected item and corresponding price to the Trolley listbox.
What I need to do is , when I dbl click a selection in the Trolley listbox, I need it to seperate the text and move it back into their appropriate listboxes, e.g. "Apples 1.20".
I am new to VB programming so any help with coding would be greatly appreciated.
Thx......
Transfering Of Items Between Listboxes
I have two listboxes. I have a list of words in the first listbox, one of which is "apple". I want to select "apple" and transfer it to the other listbox.
Right now I'm using a while/wend loop to search for the listbox index of "apple", and then when it hits, I have lstOne.RemoveItem lstOne.List(X). except... i get OVERFLOW!
So does anyone have any ideas?
Remove Same Items From Two Listboxes!
i wanted to know an effective way to remove same items from two listboxes
for example in the same list box i have
1
2
4
5
6
and in the second
2
3
8
9
0
in this case i wanted 2 to be removed from one of the listbox!
please if u know anything help me!
Swapping Items In 2 Listboxes
can someone plz tell me the best and simplest way to do this since i am a newb programmer
i am making a cricket sim
i wanna have for the team selection screen a list box that has 11 player names added on form load and another 15 or so added to another listbox which would be the reserves
i wanna make it so the user clicks on a player in the reserves list and then one in the starting 11 list (the order doesnt matter) and then they click a button which swaps them
i am sure that is possible so if someone could tell me the code that would be most appreciated
i was thinking that when u click on a player in either list box it shows that players name in one caption and when u click on a player in the other list box it shows that player anme in another caption and then u just swap the names
im not sure really
could someone just plz give me the syntax for swaping items in 2 different listboxes
example: click on 'martyn' number 5 in the list and then someone in the reserves list and click the swap button. and the reserve player becomes number 5
Removing Items From Two Listboxes
I have to listboxes List1 and List2.
If I remove an item with the listindex 2 (THe third item down on the list) from List1, how do I in turn remove the item with the listindex 2 in List2?
I am using this code so far but it's not working
VB Code:
Dim strList2Item As StringDim strList1Item As StringDim intListIndex As IntegerintListIndex = List1.ListIndexstrList2Item = List2.List(intListIndex - 1)List1.RefreshList2.RemoveItem (strList2Item )strList1Item = List1.List(List1.ListIndex)List1.RemoveItem strList1Item
How Can I Drag And Drop Items In Listboxes
ive got these two listboxes, and i want to be able to alter the position of items within one box by drag and drop, while the second listbox repositions its items simultaneously. how can i go about it?
Adding The Number Of Items In 2 Listboxes.
Hey guys I have a label1.
and two listboxes called list2 and reg.list2
Now I get the number of items in the list by doing .
Label1.Caption = " " & List2.ListCount
but is there a way to add both listbox items up and add THAT number in label1?
Thank you.
2 Listboxes-Remove Matching Items
VB Code:
'I searched and found this code that will copy all items from List1 to List2 if the'item isn't in List2. What I'm trying to do is reverse it and Remove matching items'from List2 if they do exist in List1. 'Original Code Dim i, j As Integer Dim bMatch As Boolean 'this will take strings from list1 and add to list2 For i = 0 To List1.ListCount - 1 bMatch = False For j = 0 To List2.ListCount - 1 If List1.List(i) = List2.List(j) Then bMatch = True Exit For End If Next j 'add list1 item to list2 If bMatch = False Then List2.AddItem List1.List(i) Next i 'When I change it to remove the matching item it doesn't work Dim i, j As Integer Dim bMatch As Boolean 'this will take strings from list1 and add to list2 For i = 0 To List1.ListCount - 1 bMatch = False For j = 0 To List2.ListCount - 1 If List1.List(i) = List2.List(j) Then bMatch = True Exit For End If Next j 'add list1 item to list2 If bMatch = True Then List2.RemoveItem List1.List(i) Next i
Using Index Refer To Items Between Listboxes Isn't Working
Hi,
I've got a userform that fills ListBox1 with the contents of cells in Row1 (=column headers). When the user selects items from it (multi-select=true), each of the selected items are copied into ListBox3 & ListBox4. The user can then select one of THOSE items from ListBox4 which is then saved as a string variable, 'DepVar'. Lastly, the user selects one or more other items from ListBox3 which are then fed into an array, BlossomIndepVarArr(), for use later on.
The problem I'm having is that I'd like the items in ListBoxes 3 & 4 to refer directly back to the order/index of items in ListBox1. For example, if I select items 3-6 (but not 1-2 or 7-10) from ListBox1, those three items would be copied into both ListBox3 & ListBox4; then, if I selected the 2nd item from ListBox3 and the 4th item from ListBox4, the code should recognise them as ListBox1's item 4 and item 6, respectively -- and NOT as 2 & 4.
I've tried using all sorts of arrays and counters to get the code to recognise the selected headers/items from all 3 listboxes, but none of my modifications have worked ALL of the time -- i.e. they screw up once I change the combination/pattern of selected items from ListBox1.
Here's the code most consistent (but still incorrect) version of the code. I'd love to know if anyone can see why it isn't working right:
Code:
'***fills ListBox1 (assume that everything is Dim'd correctly):
Headers = Range("A1", Range("A1").End(xlToRight)).Address
For Each WSh In ThisWorkbook.Worksheets(1).Range(Headers)
UserForm1.ListBox1.AddItem WSh.Value
WShCount = WShCount + 1
Next WSh
'***then, in the CommandButton1 procedure, this automatically selects the 2nd item from ListBox1 (if it's not selected) b/c it'll act as a reference point later on...
If ListBox1.Selected(1) = False Then
ListBox1.Selected(1) = True
End If
'***attempts to create some sort of indexing & counting system that identifies the relationship between items in ListBox1 vs ListBoxes3+4
ReDim SelArr(1 To UserForm1.ListBox1.ListCount)
For i = 0 To UserForm1.ListBox1.ListCount - 1
Debug.Print i & UserForm1.ListBox1.List(i)
If UserForm1.ListBox1.Selected(i) Then
SelCount = SelCount + 1
SelArr(SelCount) = i + 1
End If
Next i
'***copies all the selections from ListBox1 (including the automatic 2nd item) over to ListBoxes3&4
SelCount = 0
For i = 0 To UserForm1.ListBox1.ListCount - 1
' if it's selected then..
Debug.Print i & UserForm1.ListBox1.List(i)
If UserForm1.ListBox1.Selected(i) Then
'..copy it over to ListBoxes 3 & 4
' SelCount = SelCount + 1
' SelArr(SelCount) = i + 1
UserForm1.ListBox3.AddItem UserForm1.ListBox1.List(i)
UserForm1.ListBox4.AddItem UserForm1.ListBox1.List(i)
End If
Next
'***based on ListBox4 selections, this refers back to the respective index in ListBox1 & assigns its value to 'DepVar'
For d = 0 To SelCount - 1
If UserForm1.ListBox4.Selected(d) = True Then
DepVar = Sheets(UserSheet).Cells(1, SelArr(d + 1)).Value
Exit For
End If
Next d
'***based on ListBox3 selections, this refers back to the respective index in ListBox1 & assigns its value to the BlossomIndepVarArr() array
ReDim BlossomIndepVarArr(1, SelCount) As Variant
skipCount = 0
IndepColCount = 0
For p = 0 To SelCount - 1
If UserForm1.ListBox3.Selected(p) = True Then
IndepColCount = IndepColCount + 1
BlossomIndepVarArr(1, IndepColCount) = Sheets(UserSheet).Cells(1, SelArr(p + 2))
Else
skipCount = skipCount + 1
IndepColCount = p + 1 - skipCount
End If
Next p
Can you see what's going wrong?? Can you suggest a solution that'll work no matter which ListBox1 items are picked, even if the selections aren't next to each other (e.g. if I pick 2,3,4,7,9)?? I just can't seem to get this to work, so a second opinion would be REALLY helpful...
Thanks so much, F
And yes, I did post a version of this at www.excelforum.com a few days ago, but I was literally the ONLY person who looked at the thread much less replied to it. Perhaps b/c it got buried under a pile of other threads within minutes.. Sigh, guess I should have posted here instead, eh? Hope one of you excellent 'xtremers' will be so kind as to suggest a solution for me... Thx!!
Adding Items To Multi-Columned Listboxes
How do I do it? It's for a bookmark system.. also if you know how can someone show me how to save the contents of one session of the program (so the bookmarks are still there the next time it's started)
Back With 2 Listboxes In MS Access - Exchange Items
Hi everyone,
I am developing an applic. usng ms access 2003.
Lastly, I opened a thread for help about using listboxes for selecting and unselecting items by moving them between lstAvailable and lstSelected.
I stroke the solution with the help of various co-form members.
I am back with this same situation where I have a little problem..
When you see the attachment printscreen graphic, you will see that i have an error occuring with the following red code in fact:
' open the recordset.
'MyRS.Open "qrySelection", conn, adOpenDynamic, adLockOptimistic
MyRS.Open "qrySelection", conn, adOpenDynamic, adLockOptimistic
With MyRS
If .EOF Then
MsgBox "No item found to move.", vbOKOnly, "inforGT"
Exit Sub
Else
' find the record for the selected item.
.Find "StaffCode = '" & SelItem & "'"
' set the Yes-No_Fld of the selected record to "Yes".
.Fields("Selected").Value = "Yes"
.Update
' make sure the list boxes have the current values.
Me.lstAvailable.Requery
Me.lstSelected.Requery
End If
End With
If anyone has the strength to help me gaain, thanks a lot.
Moving Through Items In A Listview
Am I being a complete , or what? I'm trying to move through the items in a listview, so that I can insert the entries one-by-one in to DB - ie each item in the listview represents a new record in a DB table.
Now, I would have expected (as with all things VB) this to be quite straight forward. Something along the lines:
ListView1.selecteditem.movenext
I know this a bit hopeful, but I can't believe there's no way to incrementally move through all the items.
I've been through MSDN and searched this entire forum for a similar thing but I cant find anything.
I must be missing something really obvious here!
Moving New Menu Items From One PC To Another..
Hi there. I'm using MS Word 2003 in my PC A. I'v built a new menu (e.g. Letter Template with 35 sub menu items (each item built with some macro scripts)) on the menu bar (at the right of "Help") and now I have to work with another PC B. How can I move the new menu items from PC A to PC B without having again to use the "Customise" to add all the menu items in PC B?
Cheers.
Moving Items To The End Of The List!
hi!all!
i am looking for a code to move a selected item to the end of the list box!
for example i have a list1 with items
1
2
3
i select the first item ,item 1 and then click the button!
the item should move to the end of the list and the list would look like>
2
3
1
---------------------------
Moving Menu Items
Hi folks, I found a post the other week concerning moving menu items up and down the list by clicking and dragging them to a different place (Like in IE's faves). I was wondering if anyone could find this post as I have spent the last 20 mins looking with no solution.
Any help would be much apreciated
Lucas
Moving Items In A Listbox
Hi, I have a listbox, with the following:
[case 1]
Msg "Hello"
[case2]
msg "hello"
You can place these items on another dialog.
but, I need it to look like:
[case1]
Msg "hello"
... ---->Open a new space for more Messages when you place one.
[case2]
Msg "hello 2"
This is the code I have so far, but it isnt working.
Code:
Private Sub Command1_Click()
Dim newe As Integer
newe = Newevent.EventList(Eventnum).ListCount
Newevent.EventList(Eventnum).AddItem "<Msg>: " & Text1.Text, newe
'This bit is OK, places the message.
If Newevent.EventList(Index).Text = "..." Then
Newevent.EventList(Index).List(Newevent.EventList(Index).ListIndex) = "..."
Newevent.EventList(Index).List(Newevent.EventList(Index).ListIndex) = "<Msg>: " & Text1.Text
'Only one thing to happen for a Case
'Need it so you can have more than 1 Message under
'case 1, case 2,etc... (Move every ListItem down 1?) -Chris
Dim Position
For n = Newevent.EventList(Index).ListCount To Position + 1 Step -1
Newevent.EventList(Index).List(n) = Newevent.EventList(Index).List(n - 1)
Next
Newevent.EventList(Index).List(Position) = "..."
End If
Exit Sub
Unload events
Unload Me
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Any help would be appreciated
Chris
Moving Items Up And Down In A List Box...
Hey guys, I was wondering if anyone can help me on how to move items up and down a list box? Also, if I want to move an item start from the bottom to the top?
Please, help me...
Moving Items Around A List Box
hi !
I have yet another short query here..and would be grateful if anyone could help.
I got a list box with a playlist for a radio show..and to the right of it i have 2 more listboxes..one with duration of track and the other with the point in time at which the track starts in the show.
I have 2 buttons below up and down which when clicked on move the selected item up or down in the playlist accordingly along with the related times.
How do i do this ?
Also how do make sure that there is one item selected at aLL times.
any help would be great !
Harpooon
Moving Items In Listbox
im trying to get items in a list box to move up and down im not sure how to do it i dont have the first clue wot to do can anyone help with the code?
Moving Items In An Array
G'day
I have a numeric array (20,7).
The user is allowed to delete one line (1 to 20).
If the used deletes line 7, I need to move all items 8 to 20 down 1 and zero number 20 so I don't have a blank line in position 7
Is there an easier way to do it rather than a for/next loop
Peter.
Moving Collection Items
I've never used a Collection before and I was wondering how would I go about moving an item from one index to another?
I want to display the item that has an index of 0 and then remove it form the collection at a certain interval. Then I want to move all teh other items up a spot in the collection. (1 becomes 0, 2 becomes 1, etc.)
Thanks in advance.
Edit: Also, is there a fast way to clear a collection other than looping through it all and setting the values to null?
Moving ListBox Items
Could anyone tell me how to write a sub that allows you to click and drag an item in a listbox to a new index position within the listbox?
Ash
Moving Items In A Listbox
I have a listbox that has several items in it that i want the user to be able to move up or move down. I have two buttons, one for up the other one for down. Anyone know how to do this? Thanks!
Moving All Items From One List Box To Another
I am having problems selecting the first item in the list box. Here is the code that I have written:
Private Sub ZonesAll_Click()
Dim ZoneName As String
Dim ZoneNumber As Integer
Dim n As Integer
Dim i As Integer
n = Me.ZonesNotSelected.ListCount
'I need a line here that will select the top item in the list
For i = 0 To n - 1
Me.ZonesNotSelected.Selected
ZoneName = Me.ZonesNotSelected.Text
ZoneNumber = Me.ZonesNotSelected.ListIndex
Me.ZonesNotSelected.RemoveItem ZoneNumber
Me.ZonesSelected.AddItem ZoneName
Next i
End Sub
Thanks
SLR
Moving Items In A ListView
Hi,
I'm using a ListView to show information. I want the user to be able to click and drag one of the ListView items to move it higher or lower on the ListView. Is there any way to do this? I know that you can do it with command buttons, but is there a way to do it with the mouse?
Thanks!
Moving List Items Up And Down
This is a bit foolish question bu I forgot how to do it.
I want to move items listed in the list box up or down. How do I do it?
Kinjal
Moving Items Up/Down In List Box W/VB
There is another thread in the javascript section with almost the same title, so what I am wondering is if there is a VB version of it. The thread id is
URL
Any help would be greatly appreciated
Moving Messages From One Sent Items Box To Another!!!
Hi All
Am desperatly trying to allow PA's to send as their bosses and there be a custom rule that moves the sent item from the PA's Sent items box to the bosses sent item box. Ideally this would be automatically and not be a forward.
I have got code to check the from feild on entry to the PA's sent item box and then forward it on to the boss but I then need to populatre the from feild so that I can run a rule at the bosses end!!!
Any help would be great.
Thanks
Nathan
Moving Items In Listbox Down
This code is supposed to move items down 1 spot within the list box with the push of a cmdbutton. I got it to move one item at a time down, but ideally it should move multiple items down at the same time. Any ideas or suggestions would be greatly appreciated. Thank you.
Private Sub cmddown_Click()
Dim Temp As String, Item As Integer
Item = lstShopping.ListIndex
If (Item > -1) And (Item < lstShopping.ListCount - 1) Then
Temp = lstShopping.List(Item)
lstShopping.RemoveItem Item
lstShopping.AddItem Temp, Item + 1
lstShopping.ListIndex = Item + 1
End If
End Sub
Archie Kantzavelos
Moving/Sizing Items On A Canvas
I'm looking for some help/info on how I can move and resize objects (image controls with handles drawn around it) on a canvas (in this case the whole form which is fullscreen); like, for example, moving shapes or textboxes around the page in Word. I've had a little luck trying to figure it out myself, but it's just not working...
Moving Items From One Datalist Box To Another {Access}
Sorry if I'm posting this to the wrong forum.
I've tried searching the site for an answer, but haven't found anything that helped me...
I've got two datalist boxes (using MS Access, if that helps), and I'm trying to figure out how to move selected items from the first box to the second box.
I know that it's probably something really incredibly easy, but I can't get it for the life of me and it's making me want to ram my head against a brick wall.
Any help you guys can give will be much appreciated.
Moving Single Items From One Folder To Another
How do I go deleting a message in my inbox, and have it show up in my Trash? I know this much of the process:
1. Delete the message (Don't need info on this)
2. Empty the listview when the user clicks on the Trash folder (Don't need info on this either)
There's a Step C, which involves retrieving the sender, subject, send date, and message text from the message, just like I did when retrieving new mail. How would I retrieve the data for just that message, and add that to the now-empty listview?
An example of what I want to do would be found inside Outlook Express. Note as it empties the listview when you change folders, and then loads the contents of the selected folder.
Sorry if this seems a little vague, but that's the best I can explain it.
Moving Multiple Listview Items Up Or Down At Once
Hi, does anybody know how to move multiple selected listview items up or down at once?
I found the subs below, but they only move one item up or down, even if I have selected multiple items.
Thanks.
vb Code:
Private Enum menmDirections MoveUp = 1 MoveDown = 2End Enum Private Sub MoveItem(ByVal penmDirection As menmDirections)Dim lvwItem As ListItemDim lvwNew As ListItemDim lvwSubItem As ListSubItemDim lngIndex As Long Set lvwItem = lstView.SelectedItem If Not (lvwItem Is Nothing) Then If penmDirection = MoveUp Then lngIndex = lvwItem.Index + 2 ElseIf penmDirection = MoveDown Then lngIndex = lvwItem.Index - 1 End If If lngIndex > 0 And lngIndex <= lstView.ListItems.Count + 1 Then Set lvwNew = lstView.ListItems.Add(lngIndex, , lvwItem.Text) For Each lvwSubItem In lvwItem.ListSubItems lvwNew.ListSubItems.Add , lvwSubItem.Key, lvwSubItem.Text, lvwSubItem.ReportIcon, lvwSubItem.ToolTipText Next lvwSubItem lvwNew.Selected = True Set lvwNew = Nothing lstView.ListItems.Remove lvwItem.Index End If Set lvwItem = Nothing End IfEnd Sub
vb Code:
Private Sub MoveUp(lv As ListView) Dim itm As ListItem, itmNew As ListItem, i As Long If lv.SelectedItem.Index > 1 Then Set itm = lv.SelectedItem Set itmNew = lv.ListItems.Add(itm.Index - 1, , itm.Text, itm.Icon, itm.SmallIcon) For i = 1 To itm.ListSubItems.Count With itm.ListSubItems(i) Call itmNew.ListSubItems.Add(, .Key, .Text, .ReportIcon, .ToolTipText) End With Next lv.ListItems.Remove itm.Index itmNew.Selected = True lv.SetFocus End IfEnd Sub Private Sub MoveDown(lv As ListView) Dim itm As ListItem, itmNew As ListItem, i As Long If lv.SelectedItem.Index < lv.ListItems.Count Then Set itm = lv.SelectedItem Set itmNew = lv.ListItems.Add(itm.Index + 2, , itm.Text, itm.Icon, itm.SmallIcon) For i = 1 To itm.ListSubItems.Count With itm.ListSubItems(i) Call itmNew.ListSubItems.Add(, .Key, .Text, .ReportIcon, .ToolTipText) End With Next lv.ListItems.Remove itm.Index itmNew.Selected = True lv.SetFocus End IfEnd Sub
Listview Report Moving Items Up && Down
Hi everyone ,
I know how to move the first column field up and down in a listview report.
But now i have 10 columns and the user wants to select a row and puts it one down (if its not already at the bottom) or one up (if its not already at the top).
thx
Moving Listbox Items W/ Mouse
does anyone know how to shift listbox items around with the mouse? a good example would be winamp's playlist. the code i came up with works fine...if you move your mouse slowly. if you go fast, it'll pretty much mess up the order because the cursor jumps around when you move your mouse too quickly.
Dim HotItem1 As Integer
Private Sub List1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
If HotItem1 <> List1.ListIndex Then
If HotItem1 > -1 Then
a = List1.List(HotItem1)
b = List1
List1.List(List1.ListIndex) = a
List1.List(HotItem1) = b
End If
HotItem1 = List1.ListIndex
List1_Click
End If
Else
HotItem1 = -1
End If
End Sub
Outlook Macro- Moving Items Into Folders
hi - Im trying to get mail from specific addresses to go into appropriate folders, but my code only sorts mail for one address and not the other. What can you see that Im not seeing?
Code:
Sub Sort()
'Dim Variables
' Initialise Outlook App
Dim objOutlook As New Outlook.Application
' Initialise name space
Dim objOutlookNameSpace As NameSpace
' Initialise folders
Dim fldInbox As MAPIFolder
Dim fldOS As MAPIFolder
Dim fldSM As MAPIFolder
Dim fldPersonal As MAPIFolder
' Others
Dim lNumEmailsInInbox As Long
Dim MyMail As Items
' Set the name space to MAPI
Set objOutlookNameSpace = objOutlook.GetNamespace("MAPI")
' Set the pointer to the inbox
Set fldInbox = objOutlookNameSpace.GetDefaultFolder(olFolderInbox)
' Set the pointer to the Test folder (a folder within the inbox)
Set fldOS = fldInbox.Folders("ACM Business").Folders("01 Overstock IN")
Set fldSM = fldInbox.Folders("ACM Business").Folders("02 SkyMall IN")
' How many emails in the inbox?
lNumEmailsInInbox = fldInbox.Items.Count
' Display it on a form
MsgBox ("There are " & CStr(lNumEmailsInInbox) & " messages in your Inbox")
' Initialise Mail items
Dim MyMailItem As Outlook.MailItem
Set MyMail = fldInbox.Items
' If there are any mail items in inbox
If lNumEmailsInInbox > 0 Then
' Loop through each mail in the inbox and move it to the appropriate folder
For Each MyMailItem In MyMail
If MyMailItem.SenderEmailAddress = "overstock-orders@vcommerce.com" Then
'MsgBox ("Moving " + CStr(MyMailItem))
With MyMailItem
.Move fldOS
End With
ElseIf MyMailItem.SenderEmailAddress = "updates@Skymall.com" Then
With MyMailItem
.Move fldSM
End With
End If
Next MyMailItem
Else
Call MsgBox("No emails in inbox to move", vbAbortRetryIgnore, "Warning")
End If
End Sub
Any help would be appreciated
Thanks a lot guys.
Code For Moving To The First Blank Cell In A Worksheet; Moving Left,right,up Or Down
I have created an application form as a userform in Excel. I need to send the data entered into my text boxes when the program runs to separate excel cells in a worksheet.
My problem is I can use code that will send the textbox entry to a specific cell eg. If my textbox is named Surname I can say
range("a5").value = surname but if I do that when I run the programme to enter the next record for someone else the first record will be overwritten.
I NEED A CODE LINE THAT WILL TAKE ME TO THE FIRST EMPTY CELL AND ALLOW ME TO MOVE DOWN OR TO THE LEFT OR TO THE RIGHT
Outlook 2000 Contact Items, Deleted Items And Address Books
Hi Folks,
Apologies if this is the wrong forum to open this thread (it may perhaps prove to be better located in the MAPI forum, but is not purely MAPI)
I'm developing a COM add-in for use with Outlook 2000 upwards and have hit a couple of stumbling blocks that I'd really appreciate some help on:-
1. As part of a sync process, some contact items are occasionally deleted from a user-defined custom contacts folder (the folder is never the default Outlook contacts folder). When these contacts are deleted, I would like to move them into the "Deleted Items" folder, rather than just kill them outright.
I use a simple little loop to identify the "Deleted Items" folder and store it as a MAPI folder reference in an object called: RecycleBin as follows:-
(Global Declarations)
Global oApp As Outlook.Application
Global ns As Outlook.NameSpace
Global ns_id_num As Integer
Global RecycleBin As Outlook.MAPIFolder
Global pfolder As Outlook.MAPIFolder
(Extract from routine: GetFolder - namespace correctly referenced previously in another routine)
dim f as integer
'
Set pfolder = ns.Folders(1) 'Personal Folders
For f = 1 To pfolder.Folders.Count
If Trim(UCase(pfolder.Folders(f))) = "DELETED ITEMS" Then
set RecycleBin = pfolder.Folders(f)
End If
Next f
'
However, in the sync routine (which appears to correctly access the RecycleBin object) when I use the .move method on the given contact, for some reason the contact is moved to the DRAFTS folder and not the "Deleted Items" folder.
I'm using Redemption for the ContactItem reference, but I dont think this is affecting things as I've tried the same thing with a regular Outlook.ContactItem object and I get the same result.
Is there something special I have to do to move contacts to the "Deleted Items" folder, or do I need to do something completely different? Alternatively, is there some parameter that can be parsed to the .delete method, which instructs Outlook to move the contact to the "Deleted Items" folder, rather than wipe it from the system?
2. I would like to make the user-defined custom folder an address book reference automatically. In Outlook 2002 there are the MapiFolder.ShowAsOutlookAB and MapiFolder.AddressBookName properties, which I'm sure will work fine, but what about Outlook 2000?
I know this value can be manually set, (by right-clicking the contact folder, selecting the "Properties" menu option, clicking the "Outlook Address Book" tab and putting a check-mark in the "Show as address book" check-box) but what I really need to do, is configure this automatically.
Any and all constructive help, suggestions and ideas gratefully received.
Thanks and Regards
Hitch
Saving Items (selected Items) In List Box To A Text File
I need help in coding the following:
1. Saving (or exporting) the items displayed in List Box to a text file.
2. I have a long list of data to be displayed. When I use this List box all of my data does not fit into the width. I was wondering if there is similar other way where I can do horizontal as well as vertical scrolling. I tried text box and its of no help i guess.
Get Items / Select Items From MSAccess Form Controls
Hello,
I am supposed to automation one application which is developed in MSAccess Form. None of the automation tools support AccessFormControls.
What i did was, i get into VB, tried to do that using Win32API.
i am able to active the window, and get the child windows. But there is one sub form in the form itself. And the controls are populatd on the form. And it will be dynamic.
I am not able to enumerate the controls in it.
Can anybody help me on this?
Moving Balls To Moving Images??
Please take a look at this as it is related to my question
Thread
is it possible for the create images to be an image type that is already drawn?
How To Derive Items From Items Automatically?
Hi all,
I have a table ITEM (Item_ID, Item_Name, Value), where Value is field that holds real numbers. I have the following business rule: An item is derived from one or more items. For instance, suppose I have the following items:
Item_ID````Item_Name````Value
1``````````X `````````` 10
2``````````Y ```````````20
3``````````Z ```````````5
According to the business rule, we may have the following: X = Y+Z. So, how can represent that in a database? Can i create a unary M:N relation, where an item derives/is derived by one or more items?
Thnx in advance.
|