Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations JAE on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

auotprop custom propeties drop down 2

Status
Not open for further replies.

grunt58

Mechanical
Joined
Feb 4, 2005
Messages
490
Location
US
I like that autoprop macro and think it's excatly what we need with some massaging but have a few questions on it.


Can it link to another file?

Reason we have #'s for our materials and it's quite extensive.

Could one put the material # in and have that macro reference another file with all the material descriptions or have it some where in that .ini file to populate our material description? Theres a password to edit the macro so I can't edit that fyi.


Grant
Applications Engineer
SW2008 SP 2.0
IBM InteliStation Pro M
Nvidia Quadro FX 3000
P4 3.4 GHz, 2GB RAM
XP Pro SP2.0
 
Sure, sounds easy enough. Just create a .txt file with each line containing a material. Then use readline to populate your drop down menu. Something like this I imagine would do what you are looking for:


Private Sub UserForm_Initialize()
Set fso = CreateObject("Scripting.FileSystemObject")
Set PropertyFile = fso.OpenTextFile("C:\property file.txt", 1)

Do Until PropertyFile.AtEndOfStream
ComboBox1.AddItem PropertyFile.Readline
Loop
End Sub

This should just populate a drop down menu with whatever you have in your text file. If that is what you are looking for, I can further develop this for you. Otherwise just let me know if I'm way off from what you were asking for.
 
It would be a little more tricky, but it could probably be done using If Else statements. I think it would be easier just to have a different .txt file for each property.
 
When you select a Material Description, how could you get the Material Properties of the model to update?

"Art without engineering is dreaming; Engineering without art is calculating."

Have you read faq731-376 to make the best use of Eng-Tips Forums?
 
I am using just one data file to populate my custom properties. I have a header for each group of custom properties values, to find it, and a marker at the end. Probably I could do without the marker. The header is something like *VENDORS. This is a smaple:
Code:
*DESIGNBY
AB
CD
EF
<END>

*FINISH
#4
NONE
#2B
MIRROR
AS COMPONENT
SEE NOTE
BLACK OXIDE
<END>

*MATERIALS
ACRYLIC
UHMW-PE
WHITE DELRIN
AISI 304
AISI 316L
316L SS - 16 GA
316L SS - 14 GA
316L SS - 12 GA
304 SS - 14 GA
304 SS - 12 GA
304 SS - 10 GA
<END>

*SUPPLIERS
JACOB
ANY
CUSTOM
SPAENAUR
MCMASTER-CARR
REID
BOSTON GEAR
<END>

*DRAWNBY
AB
CD
<END>

*CHECKEDBY
EF
GH
<END>
 
Just realized I linked to the wrong property macro.

this is the one I meant.

That all would be fine but the macro is locked with a password so i can't edit it unless someone knows the password or can tell me how to by pass it.

thanks

Grant
Applications Engineer
SW2008 SP 2.0
IBM InteliStation Pro M
Nvidia Quadro FX 3000
P4 3.4 GHz, 2GB RAM
XP Pro SP2.0
 
Matt, I hope you are not pulling my leg. Here you go:
Code:
Private Sub Populate_Combos()
Dim strTemp As String

'design by
cboDesignBy.Clear
Open "C:\CustomProperties.txt" For Input As #9
strTemp = ""
Do While strTemp <> "*DESIGNBY"
Input #9, strTemp
Loop
Do While strTemp <> "<END>"
Input #9, strTemp
If (Left(strTemp, 1) <> "'") And (strTemp <> "<END>") Then cboDesignBy.AddItem UCase(strTemp)
Loop
Close #9

'finish
cboFinish.Clear
Open "C:\CustomProperties.txt" For Input As #9
strTemp = ""
Do While strTemp <> "*FINISH"
Input #9, strTemp
Loop
Do While strTemp <> "<END>"
Input #9, strTemp
If (Left(strTemp, 1) <> "'") And (strTemp <> "<END>") Then cboFinish.AddItem UCase(strTemp)
Loop
Close #9

'part materials
cboMaterial.Clear
cboMatPP.Clear
Open "C:\CustomProperties.txt" For Input As #9
strTemp = ""
Do While strTemp <> "*MATERIALS"
Input #9, strTemp
Loop
Do While strTemp <> "<END>"
Input #9, strTemp
If (Left(strTemp, 1) <> "'") And (strTemp <> "<END>") Then
    cboMaterial.AddItem UCase(strTemp)
    cboMatPP.AddItem UCase(strTemp)
End If
Loop
Close #9

'create list of Suppliers
cboSupplier.Clear
Open "C:\CustomProperties.txt" For Input As #9
strTemp = ""
Do While strTemp <> "*SUPPLIERS"
Input #9, strTemp
Loop
Do While strTemp <> "<END>"
Input #9, strTemp
If (Left(strTemp, 1) <> "'") And (strTemp <> "<END>") Then cboSupplier.AddItem UCase(strTemp)
Loop
Close #9

End Sub

I use this routine in the Form_Load routine to read my data file, populate combos and set up the form combo boxes values. Last two groups of data are used in a different part of the program. My data file allows comments to be inserted. That line has to start with "'" and it will be ignored by this routine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top