×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Error on VBS

Error on VBS

Error on VBS

(OP)
hello guys

I have this code, and when running in in CATIA it gave me an error, hope you can help me


Dim oFoundEdges
Set oFoundEdges = New Collection '(the component active x can not create the object "collection")

For j = 1 To osel.Count
sEdgeName = osel.Item(j).Value.name

Dim aEdgeName
aEdgeName = Split(sEdgeName, "face")
sEdgeName = "face" & aEdgeName(UBound(aEdgeName))
If sEdgeName = "*" & sFaceName1 & "*" & sFaceName2 & "*" Then

Dim Edge
Set Edge = osel.Item(j).Value
oFoundEdges.Add Edge
iFoundEdges = iFoundEdges + 1
End If
Next
osel.Clear

If Not iFoundEdges = 0 Then
For j = 1 To oFoundEdges.Count
osel.Add oFoundEdges.Item(j)
Next
data_file.WriteLine "Numero de aristas"
data_file.WriteLine (iFoundEdges)
data_file.WriteLine "--------------------------------------"
'Else
'MsgBox "La figura no tiene aristas"
End If

I don't know what to do,


hope you can help me

thanks

RE: Error on VBS

Dim oFoundEdges as New Collection

Eric N.
indocti discant et ament meminisse periti

RE: Error on VBS

(OP)
hi, itsmyjob

thank you so much for your answer

I tried that already, but on VBS does not accept any as ...., so I had to erase it,

at this point I don't know what to do.

hope you can guide me trough

thanks

RE: Error on VBS

dont know if you can use collection in VBS... works on VBA

Eric N.
indocti discant et ament meminisse periti

RE: Error on VBS

(OP)
thak you for your answer I found that collection can not be used

I use CreateObject("Scripting.Dictionary") and it works perfectly

thank you for your help

RE: Error on VBS

can you elaborate ?

Eric N.
indocti discant et ament meminisse periti

RE: Error on VBS

(OP)
I don't understand the question

if I can elaborate de code? or de collection?

RE: Error on VBS

can you share your solution?

Eric N.
indocti discant et ament meminisse periti

RE: Error on VBS

(OP)
oooo yes sure here is the code

Dim oFoundEdges
Set oFoundEdges = CreateObject("Scripting.Dictionary")

For j = 1 To osel.Count
sEdgeName = osel.Item(j).Value.name

Dim aEdgeName
aEdgeName = Split(sEdgeName, "face")
sEdgeName = "face" & aEdgeName(UBound(aEdgeName))
If InStr(sEdgeName, sFaceName1) and InStr(sEdgeName, sFaceName2) Then

Dim Edge
Set Edge = osel.Item(j).Value
oFoundEdges.Add j, Edge
iFoundEdges = iFoundEdges + 1
End If
Next
osel.Clear

If Not iFoundEdges = 0 Then
For j = 1 To oFoundEdges.Count
osel.Add oFoundEdges.Item(j)
Next
data_file.WriteLine "Numero de aristas"
data_file.WriteLine (iFoundEdges)
data_file.WriteLine "--------------------------------------"
'Else
'MsgBox "La figura no tiene aristas"
End If

I hope it can help

RE: Error on VBS

thanks

Eric N.
indocti discant et ament meminisse periti

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources