Type Mismatch

Mar 28, 2007 2 Replies

Can anybody tell me why the following code when trying to set boolstatus by selecting the "Front" plane generates a "Type Mismatch" error when I move the code from the VBA editor into a VB .Net class library?



This Works Fine....



Dim swApp As Object Dim Part As Object Dim SelMgr As Object Dim boolstatus As Boolean Dim longstatus As Long, longwarnings As Long Dim Feature As Object Sub main() Set swApp = Application.SldWorks



Set Part = swApp.ActiveDoc Set SelMgr = Part.SelectionManager boolstatus = Part.Extension.SelectByID2("Front", "PLANE", -0.03505230494835,



0.05069240410126, -4.704091274448E-04, False, 0, Nothing, 0)


etc ....



This causes the error... Public Sub Draw(ByVal swApp As SldWorks.SldWorks)



Part = swApp.ActiveDoc



SelMgr = Part.SelectionManager



boolstatus = Part.Extension.SelectByID2("Front", "PLANE", -0.03505230494835,



0.05069240410126, -0.0004704091274448, False, 0, Nothing, 0.0)

etc .......


Thanks for your help,



Dale


Oops Sorry, I tried changing the last argument to 0.0 but the error still occurs. Both with 0 and 0.0. Sorry I copied the code into the message after making the change.

Any suggestions?

Dale

Try some other means of selecting besides just copying the macro commands. "Point select" macro commands for selecting are usually not very good for accomplishing what you want in a program.

Learn to use the selection manager. Learn to select objects by traversing the feature tree or using commands like "Feature::Select2".

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required