cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Combobox

ptc-4260912
1-Visitor

Combobox

Hello,

when a mathcad sheet has a combobox, and I try to open it, i get an error message" an unknown runtime error occured, existing". what do i need to do to be able to open any mathcadsheet with combo boxes? Thanks!

38 REPLIES 38

Thanks John!

when i try to open that mathcad sheet, the sheet does not even open far enough to even see any thing in the sheet. The error pops up on the screen before i am able to see the sheet.

The sheet that i have now is w/o listboxes, and i am trying to insert the listboxes, but i dont know how.

when i have a listbox, and the items in the listbox are texts or words, and the output assigned to the variable is always the row number. is it possible to make it assign the item selected from the list to the variable?

for example, if i have two choices for the variable "Code" which are "ASD" or "LRFD". when i select LRFD, it makes Code= 2, but i woud like to display Code="LRFD". Is it possibe? Thanks!

jsheehan
12-Amethyst
(To:jsheehan)

Hi Sam,

I think I found what might be the basis of our issues. Apparently you are not using Mathcad list boxes. Mathcad listboxes are added to a worksheet by menu selection Insert->Control->ListBox. Is it possible you are adding listboxes to Mathcad thru Insert-Component->Scriptable Objects -> Microsoft forms ComboBox ?

I say this because you are using the List() method, which is not available in Mathcad listboxes, we use the Add.String method as demonstrated in richard's example.

Also I discover that you Excel code is not correct. This secgment all returns zeros.

Set objWorkSheet = objWorkbook.Worksheets.Item("Database v13.0")

Set objArray = objWorkSheet.Range("B"&row1,"AX"&row2)

For i = 0 to number

sect(i) = objWorkSheet.Cells(i + row1,2).Value

MsgBox sect(i)

Next

I will try to restruction your worksheet using Mathcad controls and fix the script segment you reuse in your UI components, now seeing that you were able to open Richard's worksheet.

John

jsheehan
12-Amethyst
(To:jsheehan)

Sam,

Attached is a simple worksheet which will show you how to use a Mathcad listbox, pull values from Excel using VBScript , return the selected dropdown value and the values pulled from Excel.

I hope this works for you as a template to modify your listboxes.

John

John,

i believe you are correct!!, does the method of how the list boxes were added make a difference?

but why were you and others able to open it but not the Mathcad that i have? is my mathcad any different than what others are using?

Thanks!

Sam

Hi Sam,

Using Microsoft Forms has extra security baggage and system concerns. Mathcad UI controls are limited in the methods/properties available to a scripter such as yourself, but they are usually guarenteed to work across platforms (XP-32, XP-64, Vista, Windows 7-32, Windows 7-64).

Your VBScript had some issues.. the Active Worksheet name was wrong .. at least in regards to the worksheet you posted. Also, you were using column 2 in your Excel calls, which explains why everything was zero, all your values are in column 1.

Anyways, I hope the simple excel worksheet I just posted gets you on the right track using Mathcad controls. Albeit limited in methods/properties , they are fairly certain to work across platforms.

Let me know. Good luck. and thanks everyone who responded for your guidance.

John

RichardJ
19-Tanzanite
(To:ptc-4260912)

but why were you and others able to open it but not the Mathcad that i have? is my mathcad any different than what others are using?

Which version of Mathcad are you using (including service releases)?

Mathcad14. where do i find Service releases?

Help->About Mathcad

Top of the dialog: Mathcad 15.0 (M010 [MC15_M010_20110622])

I think the combo box in Mathcad is not a correct combo box.

The correct combo box is a combination a text box and a list box:

combobox.png

Announcements

Top Tags