VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Files into ListBox

5 REPLIES 5
Reply
Message 1 of 6
Anonymous
165 Views, 5 Replies

Files into ListBox

What I'd like to do is be able to have a routine that will take the *.DWG contents of a directory and then put that list into a ListBox for a user to choose from. Basically, I'm writing a custom routine for browsing our blocks and want to be able to have it be 'flexible' in that the routine will always re-read the directory, so that if I add details, they are listed.

Here is where I'm at:
Private Sub cmdClose_Click()
Unload frmDetails
End
End Sub
Private Sub tabsDtl_Change()
lstbxDtl.Clear
detList = Dir(detDir + "*.dwg")
Do While detList <> ""
detList = Dir(detDir + "*.dwg")
lstbxDtl.AddItem detList
Loop
End Sub
Private Sub UserForm_Activate()
detID = 0
detType = "SD-1"
detDir = "C:\jwilder\detTest\"
tabsDtl_Change
End Sub

But obviously, the Do While loop will simply loop indefinitely.

Thoughts, comments?

Thanks,

Jason
5 REPLIES 5
Message 2 of 6
Anonymous
in reply to: Anonymous

On another note, how the heck to I get my posts to format out so that the code I post up isn't all jumbled into an unreadable paragraph???

Thanks... again.
Message 3 of 6
Anonymous
in reply to: Anonymous

Private Sub tabsDtl_Change()
lstbxDtl.Clear
detList = Dir(detDir + "*.dwg")
Do While detList <> ""
detList = Dir(detDir + "*.dwg")
lstbxDtl.AddItem detList
Loop
End Sub
Private Sub UserForm_Activate()
detID = 0
detType = "SD-1"
detDir = "C:\detTest\"
tabsDtl_Change
End Sub

But obviously, the Do While loop will simply loop indefinitely. Thoughts, comments?
Message 4 of 6
Anonymous
in reply to: Anonymous

"jaswild" wrote in message
news:f1191dd.1@WebX.maYIadrTaRb...

> But obviously, the Do While loop will simply loop indefinitely.
> Thoughts, comments?

Call the Dir function again with no arguments and will return the next
filename to match the initial pattern. When there are no more matches,
it'll return an empty string.

--
There are 10 kinds of people:
Those who understand binary and those who don't
http://www.acadx.com




Private Sub tabsDtl_Change()
lstbxDtl.Clear
detList = Dir(detDir + "*.dwg")
Do While detList <> ""
detList = Dir(detDir + "*.dwg")
lstbxDtl.AddItem detList
Loop
End Sub
Private Sub UserForm_Activate()
detID = 0
detType = "SD-1"
detDir = "C:\detTest\"
tabsDtl_Change
End Sub
But obviously, the Do While loop will simply loop indefinitely.
Thoughts, comments?
Message 5 of 6
Anonymous
in reply to: Anonymous

A user, Tony Tanzillo, posted this tip on properly spaced lines
from the HTTP side:

Place your text or code between a pair of PRE /PRE html tags:



Line 1
Line 2
Line 3


---
Anne Brown
Manager, Moderator
Autodesk Product Support discussion groups
Discussion Q&A: http://www.autodesk.com/discussio

jaswild wrote:
>
> On another note, how the heck to I get my posts to format out
> so that the code I post up isn't all jumbled into an unreadable
> paragraph???
Message 6 of 6
Anonymous
in reply to: Anonymous

Thank you both for your help.

Jason

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost