Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

CATIA.Documents.Item(<string>) seems to be case sensitive

Status
Not open for further replies.

Kattmandu

Automotive
Oct 31, 2022
7
If the input is not entered with case sensitivity in mind, an error occurs. So if the actual filename is "Some_Random_Part.CATPart" and the user enters "some_random_part.catpart" it throws the error "The method item failed". Is there a way around this?

Code:
Dim strFilename As String
strFilename = InputBox("Enter filename:", strFilename)

Dim partDocument1 As Document
Set partDocument1 = CATIA.Documents.Item(strFilename) <-- error on this line
 
Replies continue below

Recommended for you

Iterate through documents yourself and use whatever matching rule fits you.
 
How do I iterate through documents? I don't understand what that means.
 
iterate = loop through. what Little Cthulhu suggests is that you create a loop where you take in the user's input (perhaps capitalized), and compare it to a file name(capitalized) from within the loop. if match--then open that file

regards,
LWolf
 
Dim doc
For each doc in catia.documents
If lcase(doc.Name) = "mysmallname.catpart" then
Exit for
End if
Next
If IsEmpty(doc) then
Msgbox "not found"
End if
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor