Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Userform show from CATIA toolbar 2

Status
Not open for further replies.

Nebojsa Milic

Automotive
Aug 26, 2020
2
Hi there,

I'm trying to show userform with commands which are linked to VBA modules.
I have a module "Main_Userform_Show" which has sub procedure and vbModeless code:

Sub UsrfrmShow()
[/indent]Userform1.Show vbModeless
End Sub

When ran from module, Userform1 appears.

When ran from toolbar or CATScript which Ferdo provided, nothing happens;

Sub UsrfrmShow()

Dim param ()
Dim oFilePath, oFileName, oModule As String
Dim oSystemService As Variant
Set oSystemService = CATIA.SystemService

oFilePath = "D:\Works\_Macro\VBA"
oFileName = "VBA LIBRARY.catvba"
oModule = "Main_Userform_Show" ' module name

Dim ss as Variant
Set ss = Catia.SystemService
ss.ExecuteScript oFilePath & oFileName , catScriptLibraryTypeVBAProject , oModule , "UsrfrmShow" , param

Names of userform and module:

Can anyone point me to right direction?

End Sub
 
Replies continue below

Recommended for you

Change vba code to:

Code:
private frm as userform1
Sub UsrfrmShow()
  Set frm = new UserForm1
  frm.Show vbModeless
End Sub
 
Thanks @Little Cthulhu.
Sorry for late answer, I have managed to do it just renaming UsrfrmShow() to SubCATMain() and it worked...
 
Hi,

I'm trying to run UserForm from CATScript using code above, but I am getting an error, Class UserForm does not exist
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor