Get DragDrop Items.Index Or Item(Name) On ListView With Scrollbar?
Hiya's folks
Here's my bug Code: Private Sub lstView1_OLEDragDrop(Data As MSComctlLib.DataObject, Effect As Long, _ Button As Integer, Shift As Integer, X As Single, Y As Single)
myIndexItem = lstView1.ListItems.Item(Int(Y / 17) + 1)
End Sub
I'm using this statement to get the item name, but when the V-scrollbar is scrolled down... I can't get the good item since I'm using the Y parameter Any idea how to get the index of the first item displayed in listview when the scrollbar is scrolled? Or is there a way to get the "visual" name of the item I drag on?
Thx!!
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Listview - DragDrop Multiple Items
I have the following code that successfully will drag & drop one item at a time, but doesn't work all the time if multiple rows are selected?
When I start to drag, sometimes nothing happens.
Anybody point me in the right direction please?
Code:
Private Sub lvwSelected_OLEDragDrop(Data As MSComctlLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
On Error GoTo ErrTrap
Dim i As Long
Dim lvwItem As ListItem
For i = 1 To lvwSource.ListItems.Count
If lvwSource.ListItems(i).Selected = True Then
Set lvwItem = lvwSelected.ListItems.Add(, , lvwSource.ListItems(i).Text)
lvwItem.SubItems(1) = lvwSource.ListItems(i).SubItems(1)
lvwItem.SubItems(2) = lvwSource.ListItems(i).SubItems(2)
'remove original item
lvwSource.ListItems.Remove i
End If
Next
Also, when dragging multiple items across, and removing the original item, I now get an error because the ListItem.Count is now out of bounds.
How would I handle this?
Would I add 1 to the value of 'i' before the next loop?
Click Item In Listview Then Show That Item In Combo As Index = 0
Hi guys,
I have a listview (lvwUserPunchedOut) that is populated with records in a database (persons first name in one column and last name in the second column), what I am looking to do is if I select a persons name by clicking on it in the listview on frmMain, and then bring up frmSearchCriteria, i would like to show that selected name in the combobox as default (cboEmployee.ListIndex = 0) on frmSearchCriteria (the combobox is sorted = True and is also populated with first name and last name of the person)
How would this be done? Hope I make sense. Thanks in advance.
Dragdrop Moving Wrong Item In Listbox(aborted Dragdrop Idea)
I am using dragdrop in a list box(checkbox style) to move items around but sometimes it picks up the item below the one I selected instead of the one I clicked on. ANy ideas? heres the code I'm using
Code:
Private Sub lstFields_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If (Button And vbLeftButton) = vbLeftButton Then
nDragIndex = Y Me.TextHeight("Xyz")
If nDragIndex >= 0 And nDragIndex < lstFields.ListCount Then
blnDraging = True
End If
End If
End Sub
Private Sub lstFields_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim nIndex As Integer
Dim sItem As String
If (Button And vbLeftButton) = vbLeftButton Then
If blnDraging = True Then
nIndex = Y Me.TextHeight("Xyz")
If nIndex > lstFields.ListCount - 1 Then
nIndex = lstFields.ListCount
ElseIf nIndex < 0 Then
nIndex = 0
End If
If nIndex <> nDragIndex Then
sItem = lstFields.List(nDragIndex)
lstFields.RemoveItem nDragIndex
lstFields.AddItem sItem, nIndex
End If
End If
blnDraging = False
End If
End Sub
This is my first post with code in it so I hope I did it right, sorry if I didn't.
Sunflower Queen
Retrive Index Of Item In Listview?
How the hell do i retrive the index of an Item in a listview control?!
Sometimes I just hate this cnotrol...its too complicated...
Anyone?
Setting Listview Item To An Index Number
Ive been using the following to set the selected item in my listview:
VB Code:
MatchFiles.SelectedItem = MatchFiles.ListItems(OldName)
which sets the current item equal to that contained in 'OldName'.
Is there a command similar to set the selected item to an index number? So i could set row 7 to selected? Thanks
Problem Transfering Listview Item To Textbox With Index
Hi all i got a listbox called listbox2 and it has some url on it. I want to transfer listbox item to a textbox once i click on listbox item .But when i try the follwoing with a textbox that it index property set to 0 i get error :
VB Code:
compile error: Invalid use of property
code:
VB Code:
Private Sub Command1_Click() txtURL2 = List2.Text ' put the value of listbox to textbox txturl End Sub
I tried the same method with textbox that its index property is empty and it worked fine but it does not work with textbox that its index property set to 0. I be happy if some one help me here.Thanks
Index Of Newly Added Item In Sorted Listview
I need to find the index number of the item last added to a listview.
I can use listcount, except if the user clicks on the column header
and sorts the list, then the next item added could be listed in the
middle of the items already in the list. So .ListCount would not work
in that situation. So if I have a listview with items #1,#2,#3, and
I add an item which is placed in between #1 and #2, how can I find out it's spot in the list????
Any ideas or direction would be very helpful.
How To Get Item Clicked On Listview At Mousedown Time/dragg Items About Within A Lvwl
Tell which item clicked in listview...but theres a catch!
Please, is there a way to get the item clicked in a listview in report mode BEFORE the click is complete?
Ie when the mousedown event is raised, how can i know which item is clicked?
If you happen to know an easy way of dragging items around inside a listview (ie drag & drop to change the order) this may help, too.
I was gonna use the mousedown to save the item selected into a a variable then the OLE drag complete event to copy the data to the new location.
you`d think this would be easy...and maybe it is!
Hope you can help
ListView - DragDrop
Hi,
I have some problems implementing OLE Drag and Drop in a ListView.
I want to use Drag and Drop to order items manually. To do so I need to now where I Drop the drag (which item...) I use HitTest(x,y) to know where my cursor is, but I think it is all messed up...
OLEDragOver, OLEDragDrog returns X and Y as single but HitTest don't seem to use the same references... (Pixels, Twips,... )
Need help...
ListView DragDrop
I have a ListView on one of my forms, its setup as a report view for multiple reasons i wont get into here..
What im trying to do is make it so that the user can select an item, and drag and drop it into a multi-line text box, and it will display the text in the text box from the first column of the item they dragged over.
The problem is, when the user does this, it removes the item from the ListView.. Is there a way to make it automatically copy the item instead of moving it?
All i did to setup the drag and drop is change the OLEDragMode of the ListView to Automatic, and the OLEDropMode of the text box to Automatic...
Ive never used drag and drop before so im kinda clueless...
Dragdrop With A Listview
I've got a listview in report mode (it's a small table, really), and I want the user to be able to change the order of the rows. They should be allowed to click on row 5, drag it up a ways, and drop it between rows 1 and 2 (those are arbitrary numbers). All I want is to allow dragdrop support to the report mode of the listview, but it's eluding me.
Thanks in advance,
bob
ListView OLE DragDrop?
I have a listview where items can be "drag/dropped" into. The problem is that I only know how to add the items to the end of list. How can I insert an item where the drag stops. So if i release the mouse at index 10 in the listview, how do I tell it to insert the Drag data there and not just add it to the end? Thanks in advance!
DragDrop And Listview Control
Does anyone know the trick to dragdrop one file or multiple files from a browserscreen in Windows into a ListView control within my application.
The properties of the selected files should be added to te following properties of the newly added listitems:
Only the filenames ----> ListView.ListItem(x).Text
Path & filenames ------> ListView.ListItem(x).Key
Many thanks in advance,
VbHenk
Get The Item Index
I have a UserControl that uses two classes the individual class and a collection class, how I can implement into the Individual class to get te Index number into the collection class ???
like ListItem and ListItems
Example:
Dim LstItem as ListItem
Set LstItem = ListView1.ListItems(1)
'I want this
Msgbox LstItem.Index
'This prints 1
Thanks !!
Tab Index To Get To Next Item
I have set up the tabindex on my form to go to the correct place when the tab button is pressed. I need it to select the text in the text box when the tab button is pressed. Right now it goes to the begining of the text box but does not select the information in the text box. Any ideas would be appreciated.
Index For Items In Listbox
Hi all, sorry to ask question again... I spent near half a day could not work it out. My question looks very simple (might be very simple for you), here is a list2 shown like:
apple
orange
banana
.
.
Lime
.
.
The order of this list could be changed by user, in the end, I need to assign the index of "lime" for example, to a text field (txtorder). list1.list(0) = "Lime", but how could I get its new index in list2? How can index be looked up by its content (string)? Any help is much appreciated.
Select All Index Items
I have a form with three items on it. each item has 60 index's
WebAddress(0) - WebAddress(60)
btnGO(0) - btnGO(60)
Label(0) - Label(60)
when the form loads it hides all of the items that have nothing in the webaddress text box. so if there is no address in WebAddress(12) it will hide WebAddress(12) btnGO(12) and Label(12)
when I edit the form I want to show all of the items so I can manually type in the web address. Is there a fast way to select all the items and make them visible?
Thanks,
Mike
Getting The Index Of Items In A Listbox
i go through the listbox using
dim x as integer
dim intIndex as integer
for x = 0 to listbox.listcount
intindex = listbox.list(x).index
next x
i recieve an error..
i want to get the index of all the items in the listbox and put that in a variable as it goes throught the list... any ideas?
Cannot Get Index Of Item In Combo
i have added each printer on the system to a combo box:
for each prn in printers
cboPrinter.additem prn.devicename
next
then set the first item to be systems default printer:
cboPrinter.Text = Printer.DeviceName
When i click a button to get the index of the item in the dropdown box:
For i = 0 To cboPrinter.ListCount - 1
MsgBox cboPrinter.List(i) & cboPrinter.ListIndex
Next
it says the listindex for each item is -1. Shouldn't it be 1 to how many printers there are in the list ie:
printer 1 = index 1
printer 2 = index 2
etc?
Or is that method of setting the default printer wrong and interfering?
thanks for your time.
Recieving Item By Index
hi,
with this piece of code im trying to receive a certain record by stating the ID in the table.
i have a variable which stores the ID, intStaffID. but im not sure where to place it in the following code.
this is on the click event of an mshflexgrid. it stored the ID, then i want it to select the staff record with that ID...
Code:
If Not IsNull(myRecSet.Fields("shiftstartMon").Value) Then 'Validation for null value
strGetMonStart = myRecSet.Fields.Item("ShiftStartMon").Value 'Get data from field
txtShiftStartMon.Text = strGetMonStart 'Insert data to textbox
Else
txtShiftStartMon.Text = "No Shift" 'Insert "No Shift" If value = Null
End If
thanks,
sam
Index Of Selected Item
Anybody out there know a quick way for me to find out the index of a selected item within a listview?
I know I could loop through it easy enough to find the index but is there another way of doing it?
Api To Get The Index Of An Item In A ComboBox
Hi,
Is there any APi that give us the index of comboBox item? For instance, I would say the item as a tring and then the APi would tell me is index in the combo?
PS: I need this to get the index of a itemdata.
Thank you
Sergio Oliveira
How To Get The Item Index In Wmp.dll Control
hi, please if somebody can tell me how can i get the item index of a media item in a playlist in this control (wmpsdk 10 or 9)
i want to know the item index of the current media playing (maybe the same media is twice or more in a playlist in diferent position (index), so i can use isidentical)
thank you
Please Help - Error 457 - Index Already Associated With This Item.
Simple form used to input 2 strings (key & value), to be stored in Dictionary (dictLocations)which is instantiated in Module1. Works fine until user clicks yes in message box, then get Error 457 (duplicate key)???
Thanks for anyone's help!
private Sub cmdOK_Click()
Dim key as string, val as string
dictLocations.Add tbLocNo, tbLocDesc
If MsgBox("Add Another Location?", vbYesNo) = vbYes then
me.Hide
tbLocNo = ""
tbLocDesc = ""
me.Show
else
me.Hide
End If
Unload.me
End Sub
Getting The Index Of A Collection Item.
Is it possible to get the Index of a collection item if you know the key it was added under?
example:
dim Mycol as new collection
Mycol.Add "keyboard","bob"
Mycol.Add "monitor","peter"
Mycol.Add "desk","joe"
I want to know that "monitor" is the second item in the list by using the key "peter" can this be done?
Jean-Guy
Help Getting Correct Index Of Menue Items
HI all i am using this code to select 2th menue item on external window. The way i selected number 2 was by trial and error. Is there a way to get the remaining indexes ? since there are more items in the same menue to be selected and i want to know their indexes in adavance instead of trial and error method. I be happy if some one help me here or show me a better way.Thanks
VB Code:
Private Declare Function GetMenu Lib "user32" (ByVal hWnd As Long) As LongPrivate Declare Function GetSubMenu Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long'Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As LongPrivate Declare Function GetMenuItemID& Lib "user32" (ByVal hMenu As Long, ByVal nPos _ As Long) Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As LongConst WM_COMMAND = &H111 Private Sub Command1_Click()Dim hMenu As Long, hSubMenu As Long 'get the handle of the current menu Dim ptwnd As Long ptwnd = FindWindow("SEINFELD_SUPERMAN", vbNullString) hMenu = GetMenu(ptwnd) 'get the handle of the first submenu hSubMenu = GetSubMenu(hMenu, 3) 'initialize the structure [b]ItemID = GetMenuItemID(hSubMenu, 2)[/b] PostMessage ptwnd, WM_COMMAND, ItemID, 0End Sub
Loop The Loop: Adding List Item And Sub-items Assigned To Items.
Hello there,
below are the codes i've written to record all the items (which are qnsID) in list box (List1) into qnsdata_table.
Code:
Private Sub Command6_Click()
Dim x As Integer
Dim y As Integer
x = List1.ListCount
y = 0
rst.Open "SELECT * from qnsdata_table", cn, adOpenDynamic, adLockOptimistic
Do While Not y = x
rst1.Open "SELECT qnsdataID from autonumber", cn, adOpenDynamic, adLockOptimistic
rst.AddNew
rst!qnsDataID = "qd" & Right("000000" & CStr(CInt(rst1!qnsDataID) + 1), 6)
rst!qnsID = Me.List1.ItemData(y)
rst.Update
rst1.Close
rst1.Open "UPDATE autonumber SET qnsdataID = qnsdataID +1", cn, adOpenDynamic, adLockOptimistic
y = y + 1
Loop
rst.Close
End Sub
The problem is that for each item (qnsID) there are several assigned (ansID) and i need them to be recorded along with the qnsID, into qnsdata_table.
______________________________
| qnsdataID | qnsID | ansID |
-----------------------------------
| qd0001 | qns0002 | ans0012 |
| qd0002 | qns0002 | ans0016 |
| qd0003 | qns0002 | ans0001 |
------------------------------------
In this case, should i have another Do While Loop within the current Loop, to find out how many 'ansID' there are which are assigned to each 'qnsID'.
I've tried
Code:
rst2.Open "SELECT Count(ansID) AS ansID_count FROM ans_table where....(conditions)
Me.Text2 = rst2!ansID_count '(ive no idea where to store the count) value)
a = Me.Text2 '(shift value into variable a)
b = 0
and here goes another loop, but it didn't work.
Need some advice and comments from you guys =)
Thanks a million.
Astrov
Getting Item Data Index With Listbox Value
I'm trying to get the itemdata int value from a listbox using the listbox text value. For example:
populate the listbox using a query:
rst = select id, value from table
While (Not (rs.EOF))
lstbox.AddItem rst!value
lstbox.ItemData(lstbox.ListCount - 1) = rst![id]
rstSiteID.MoveNext
Wend
So what i want to do is get the "id" value from a selected
"value" in a listbox.
Any help would be appreciated.
>> How To Determinate The Index Of An Item In Array
Hi! I have 2 arrays called "id()" and "name()" and when I assign a string value to the name array, I assign also an id.
so... i want to get the index by specifing the item in the "name" array like this:
1st item= "a" index = 0
2nd item = "b" index = 1
and if i want a function that determinate the index of an item by specifing the text in this case
thanks
simons
Remove Item Index Number 1
Hello, I am making a list of people that connect to the chat room of there IP in a list called listPeople. But i want to remove the ip when they disconnect. I know the code is something like this, but can you help me get it right?
listPeople.removeitem(UserIP, [1])
UserIP being a String of thier remoteIP
and
1 being the index
also will the same code work with listpeople.additem?
Thanks in advance/.
Using The Index Number Of An Item In An Array
Another easy one (sorry!) :-)
I am trying to use the number of the items in my array so that, say:
If ArrayOne (Item number is 1 or 2 of array) Then
Do this
If ArrayOne (Item number is 3 or 4 of array) Then
Do this
Etc...
Is it possible?
Thanks for reading, Chloe x
Calling An Item By Its Index In A Type
Let's say I have a Type like this:
VB Code:
Public Type userinfo()Name As StringPassword As StringEnd Type
Now, if I want to access the item "Name", I need to say
VB Code:
Dim i As userinfoMsgbox i.Name
Can't I access an item by its position or index like this:
VB Code:
Dim i As userinfoMsgbox i.Index(0)'The above code is not right but it gives you the idea.
?
Index Of Selected List Item
I have a combo box, style 1, where users can enter items into the list by typing it then hitting enter. I want the user to be able to select one of the list items already entered and be able to delete it by pressing the delete key.
How can I delete the selected record?
Selecting An Item From A DataCombo Using The Index ID
Good morning all. I have a DataCombo control (not to be confused with ComboBox) which is populated with data. I am wondering how I can display the Description (ListField) text by referencing the Index ID (BoundColumn) i.e.
I have three entries in the DataCombo
0. Red
1. Green
2. Blue
I want to reference which is to be shown by the number, but I want the string to be displayed.
How I Could Get The Index Adding An Item To A List?
The solution could be this :
List1.AddItem ("" , Index)
but, it does not work!!!
First i have a compiler error (expected = )...
Num = List1.AddItem ("" , Index) Solves the problem, but if index is diferent than 0 this doesnot work.
I want to create a dinamic list of errors and capture his identification.
How i could do this?
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!!
Question About Removing Listbox Items And Their Index
does vb reassign index numbers?
say i have a list of five items in a listbox
item(index)
-------------
item1(0)
item2(1)
item3(2)
item4(3)
item5(4)
now i remove item 3......how does this affect the indexes of the rest of the list....does it reassign them so that the indexes are 0-3 with item 4 becomming index 2 or does it leave it the same
now after removing item 3, if i were to add item6....does this get index 2 or 5? (this question may be answered from the answer to the previous one).......
How Can We Know The Index Of An Item Data Value In A DropDownList Combo In VB6
I would like to receive help on the following described issue.
In my form I have a dropdown list combobox, which is populated with 'additem' and 'Itemdata' methods. during program execution, I know only a particular value stored in the itemdata. I dont know index and listed values.
I want to get the index corresponding to the Itemdata Value. How can i get that?
Thanking everybody,
sreeraj
Finding The Index Of A Control Array Item
Hey im really new with VB,
I have a control array in my project and i need to find out which element in the array the user clicked on.
Just to clarify, say theres 5 elements in the array
option(1), option(2), option(3), option(4), option (5)
when the user clicks on any of these i need to assign the number in the index, (1,2,3,4 or 5) to a variable. Thanks a lot!
List Box Q, Remove An Item, By Value Not Index? *solved*
Is there an easy method to remove an item from a list box, if there is more then say, one item in the list for a particular Value etc?
Say i have a list:
Wayne
Joe
Fred
Bob
Fred
And my server sends the message to the client "Remove Fred", (I have this bit working ),
How can i remove both "Fred"'s without knowing their ListIndex's?
Tnx
Get Handle On File Via Numeric (item) Index
Hi there,
First time poster...
I'm using VBA in Office 2003 Excel and am trying to get a handle on a file via a numeric index. Basically i have a folder containing some 527 files and need to loop thru them all and process them.
so I am trying to do something like this but it's not working - anyone know what i'm doing wrong?
Set fs = CreateObject("Scripting.FileSystemObject")
Set f4 = fs.getfolder(Path_str).files.Item(1) <== fails
I have previously tried a for...each loop without success - the loop exits unexpectedly after processing the 132nd item. Have attempted processing the item in question using a smaller set of data (ie when the folder only contained 5 items, the item in question was in the middle of the 5 files) and the macro was able to process and continue to the next item successfully. So believe that it's not related to the content of the file itself.
Is there some kind of limit to the number of items a variable can hold in VBA? When I step thru the code, the loop dies as soon as I try to step thru the "Next f3" statement.
Here's my code, if anyone can spot what might be causing the issue then please let me know:
Dim fs, f, f1, f2, f3, fc, fd, fe As Object
[...snip...]
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.getfolder(QARunEnvPath_str)
Set fc = f.subfolders
[...snip...]
'
' Get a handle on Business Function subfolders and start loop
'
For Each f1 In fc
'
' Create a copy of the Test Data Folder using the DIR suffix string
'
NewFldr_str = f1.Path & cDIR_SUFFIX
fs.Copyfolder f1.Path, NewFldr_str
'
' Get handle on files within new folder, then start looping thru those
'
Set f4 = fs.getfolder(NewFldr_str)
Set fe = f4.Files
For Each f3 In fe
[Do stuff....]
Next f3 ' Next File
Thanks in advance
|