is it possible to make an exe out of an VBA project? or to run a script outside de VB editor?
is it possible to make an exe out of an VBA project? or to run a script outside de VB editor?
(OP)
Hi guys, i was wondering if a could make an exe out of an VBA project, since i couldn't run it from VBS by pasting the code directly into it,
- is there a way to run it outside the visual basic editor?
- should i buy VB6 and try to run it from there?
THANKs in advance.
here's my code
- is there a way to run it outside the visual basic editor?
- should i buy VB6 and try to run it from there?
THANKs in advance.
here's my code
CODE --> VBA
Sub CATmain()
'Declaracion de variables
Dim spabench As SPAWorkbench
Dim mymeas
Dim ref1 As Reference
Dim myans As Double
Dim InputObjectType(0)
'Devuelve el numero de caras de la parte
Set objsel = CATIA.ActiveDocument.Selection
objsel.Clear
objsel.Search "Type=Topology.Face,all"
MsgBox objsel.Count2
X = objsel.Count2
'**************CICLO***************
For i = 1 To 5 'Aqui va x
Set partDocument1 = CATIA.ActiveDocument
Set part1 = partDocument1.Part
Set Selection = partDocument1.Selection
Set ref1 = Selection.Item(i).Reference
Set spabench = partDocument1.GetWorkbench("SPAWorkbench")
Set mymeas = spabench.GetMeasurable(ref1)
Dim mycoord(2)
mymeas.GetCOG mycoord
MsgBox mycoord(0)
Next
'***********************************
End Sub 




RE: is it possible to make an exe out of an VBA project? or to run a script outside de VB editor?
You can run directly the vba, why do you need to put it in CATScript or catvbs ? You don't have VBA installed ?
Almost any code can be "converted", also this code can be put it in CATScript...
Regards
Fernando
https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...
RE: is it possible to make an exe out of an VBA project? or to run a script outside de VB editor?
RE: is it possible to make an exe out of an VBA project? or to run a script outside de VB editor?
CODE --> CATScript
Sub CATmain() 'Declaracion de variables Dim spabench As SPAWorkbench Dim mymeas Dim ref1 As Reference Dim myans As Double Dim InputObjectType(0) 'Devuelve el numero de caras de la parte Set objsel = CATIA.ActiveDocument.Selection objsel.Clear objsel.Search "Type=Topology.Face,all" MsgBox objsel.Count2 X = objsel.Count2 '**************CICLO*************** For i = 1 To 5 'Aqui va x Set partDocument1 = CATIA.ActiveDocument Set part1 = partDocument1.Part Set Selection = partDocument1.Selection Set ref1 = Selection.Item(i).Reference Set spabench = partDocument1.GetWorkbench("SPAWorkbench") Set mymeas = spabench.GetMeasurable(ref1) ReDim mycoord(2) mymeas.GetCOG mycoord MsgBox mycoord(0) & " " & mycoord(1) & " " & mycoord(2) Next '*********************************** End SubRegards
Fernando
https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...
RE: is it possible to make an exe out of an VBA project? or to run a script outside de VB editor?
CODE --> CATscript
Sub CATmain() 'Declaracion de variables Dim spabench Dim mymeas Dim ref1 Dim myans Dim InputObjectType(0) 'Devuelve el numero de caras de la parte Set objsel = CATIA.ActiveDocument.Selection objsel.Clear objsel.Search "Type=Topology.Face,all" MsgBox objsel.Count2 X = objsel.Count2 '**************CICLO*************** For i = 1 To 5 'Aqui va x Set partDocument1 = CATIA.ActiveDocument Set part1 = partDocument1.Part Set Selection = partDocument1.Selection Set ref1 = Selection.Item(i).Reference Set spabench = partDocument1.GetWorkbench("SPAWorkbench") Set mymeas = spabench.GetMeasurable(ref1) ReDim mycoord(2) mymeas.GetCOG mycoord MsgBox mycoord(0) & " " & mycoord(1) & " " & mycoord(2) Next '*********************************** End Suband it works from a macro .catvbs file outside VBA.