Home > Software engineering >  Catia VBA secondary development problems
Catia VBA secondary development problems

Time:11-13

When I was in use the selection selectelement2 method, encountered the following problem: compile error: mark to restrict the function or interface, or function using the visual basic does not support automation (automation) class, the following figure, don't know how to solve, a great god please help,

CodePudding user response:

This error message is that the interface is not for you,
Check the related documents, take a look at your requirements, should call which interface function in VBA,

CodePudding user response:

Is that the function, and also gave the official sample, although I couldn't run even if the official example, this definition is that it is in the VBA:

CodePudding user response:

Even the "official example" can't run, what way,


How documentation is in English? This is the foreign software...
Don't know can send an email to their technical support to consult,

CodePudding user response:

You try to put the variable type redefined:
Dim InputObjectType (0) as CATSafeArrayVariant

In addition, it is CATBSTR type "string"?
I'm afraid that's a question,

Don't know variables defined as CATBSTR type, can directly use the string assigned to it?
If you can, you try to define two variables, called the second parameter and receive the return value, use this type of variable,

CodePudding user response:

I tried, I found CATSafeArrayVariant not predefined classes, but help document, but don't say so,

CodePudding user response:

Ha ha...


It is smart!
You define a Type, is SAFEARRAY Type, the Type of "change the shell,"

And that CATBSTR type, estimates that can give it such a definition:
 Private Type CATBSTR 
Member As String
End Type

CodePudding user response:

If you need to multiple modules in the use of ", that this type definition will be written in a standard module, defined as Public,
Just use it in a single module, defined in the module to be used into Private,

Of course, in either case, is written in the standard module also can be defined as Public,

CodePudding user response:

If the type library reference is wrong?

CodePudding user response:

Just do not need the as dim, give it a try

CodePudding user response:

You this is in the VB call catia class library? Confirm whether your project reference has reference to the corresponding DLL or exe,
Feel the official example can don't use your environment should be set or prepositive object didn't establish a good cause,

CodePudding user response:


A) Dim Selection As Selectiom changed to Dim Selection (remove behind As Selection)
B) check the UserForm ShowModal attribute is set to True
  •  Tags:  
  • VBA
  • Related