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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run-time Error 13 : Mismatch Type

Status
Not open for further replies.

VBAacad2007

Technical User
Oct 11, 2007
1
US
I'm writing these code for VBA in AutoCAD 2007
I keep getting "Run-time error 13 : Type mismatch" on line as indicated in the attached code below. Thanks in advance!


Private Sub UserForm_Activate()
With cboInch
.AddItem "3/12"
.AddItem "1/64"
.AddItem "3/4"
.AddItem "1/2"
.AddItem "1/4"
.AddItem "3/16"
.AddItem "1/8"
.AddItem "3/32"
.AddItem "1/16"
End With

With cboFoot
.AddItem "1"
.AddItem "10"
.AddItem "15"
.AddItem "20"
.AddItem "25"
.AddItem "30"
.AddItem "40"
.AddItem "50"
.AddItem "60"
.AddItem "100"
End With

End Sub

Private Sub btnConvert_Click()

tboScaleFactor.Value = cboFoot.Value * 12 / cboInch.Value
'''got error "Run-time Error #13 : Type Mismatch"

'coverted to type double --does not work
' tboScaleFactor.Value = CDbl(cboFoot.Value * 12 / cboInch.Value)

' MsgBox "Inch Value: " & cboInch.Value
' MsgBox "Foot Value: " & cboFoot.Value

End Sub
 
Hi VBAacad2007,

You're trying to divide a number by a string...

Try this instead:
Code:
tboScaleFactor.Value = cboFoot.Value * 12 / [red][b]CDbl[/b][/red](cboInch.Value)

HTH
Todd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top