Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Status
Not open for further replies.

Kattmandu

Automotive
Oct 31, 2022
7
0
0
US
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 = 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.
Back
Top