How to lock a VBA project for viewing?

How to lock a VBA project for viewing?

Anonymous
Not applicable
1,130 Views
13 Replies
Message 1 of 14

How to lock a VBA project for viewing?

Anonymous
Not applicable
Hi,

I'd like to know why I can't lock my VBA project for viewing? Is there something I'm not doing correctly? Is it that the code still available for viewing but not for editing?

Thanks!
0 Likes
1,131 Views
13 Replies
Replies (13)
Message 2 of 14

Anonymous
Not applicable
Use the password to lock it from viewing
CVA

--
www.CVAengineering.com

IV11 Pro. sp2 and IV2008 Pro. sp1
Window XP Pro sp2
Pentium 3.2 Ghz, 3.0 GB of RAM
NVIDIA FX 3400 91.85
SpacePilot V 3.3.6
wrote in message news:[email protected]...
Hi,

I'd like to know why I can't lock my VBA project for viewing? Is there
something I'm not doing correctly? Is it that the code still available for
viewing but not for editing?

Thanks!
0 Likes
Message 3 of 14

Anonymous
Not applicable
I know that but it doesn't work. Do I have to exit IV and restart it or completely reboot my computer or anything else?
0 Likes
Message 4 of 14

Anonymous
Not applicable
No need to reboot the computer, just exit the IV and restart it again
When you click on the + sign in fron of the project to expand it, you
should see a pop-up win asking for password - see att. image
However, it's not a very good way to protect the VBA prog. from viewing it.
I'd prefer add-in with more secure.
CVA


--
www.CVAengineering.com

IV11 Pro. sp2 and IV2008 Pro. sp1
Window XP Pro sp2
Pentium 3.2 Ghz, 3.0 GB of RAM
NVIDIA FX 3400 91.85
SpacePilot V 3.3.6
wrote in message news:[email protected]...
I know that but it doesn't work. Do I have to exit IV and restart it or
completely reboot my computer or anything else?
0 Likes
Message 5 of 14

Anonymous
Not applicable
Ok, thanks!
Is it normal that if I lock it, I can't execute it?
0 Likes
Message 6 of 14

Anonymous
Not applicable
No, it's not. You or anyone should be able to execute it, howver, need to
provide password to view it
CVA

--
www.CVAengineering.com

IV11 Pro. sp2 and IV2008 Pro. sp1
Window XP Pro sp2
Pentium 3.2 Ghz, 3.0 GB of RAM
NVIDIA FX 3400 91.85
SpacePilot V 3.3.6
wrote in message news:[email protected]...
Ok, thanks!
Is it normal that if I lock it, I can't execute it?
0 Likes
Message 7 of 14

Anonymous
Not applicable
Thanks for your help but it's not the case.
If I lock it, I can't execute it without the password!
Anybody else (maybe from Autodesk) can help me?

Thanks!
0 Likes
Message 8 of 14

Anonymous
Not applicable
sounds to me like you don't have a known entry point. when it's unlocked are
you running by either pressing Alt-F8 in Inventor or running a macro from a
command button? or are you pressing F5 from within the VBA editor? without
seeing some code it's nearly impossible to tell.

joe ...

wrote in message news:[email protected]...
Thanks for your help but it's not the case.
If I lock it, I can't execute it without the password!
Anybody else (maybe from Autodesk) can help me?

Thanks!
0 Likes
Message 9 of 14

Anonymous
Not applicable
When it's unlocked, I can run it by either F5 or by a macro from a command button. When I run it by a macro, I use my default VBA project to call the loading of this project and I call to execute the first Sub to start it as follow (I modified the code here to make it easier to read so don't tell me I made syntax mistake or something like this) :

=========================
If DragonFlyCharge = False Then 'Project not loaded yet
ThisApplication.VBAProjects.Open("G:\Dessin\Inventor\DragonFly\VBA\DragonFly.ivb")
NombreDeProjets = ThisApplication.VBAProjects.Count
Set MonProjet = ThisApplication.VBAProjects.Item(NombreDeProjets)
End If

MonProjet.InventorVBAComponents.Item("DragonFlyStart").InventorVBAMembers.Item("DragonFly").Execute
==========================

It works just fine as long as I don't lock the project with a password. As soon as I lock it, the code stops at the last line which is suppose to execute the Sub "DragonFly".
0 Likes
Message 10 of 14

Anonymous
Not applicable
is the sub your calling to run your application declared as public?

joe ...

wrote in message news:[email protected]...
When it's unlocked, I can run it by either F5 or by a macro from a command
button. When I run it by a macro, I use my default VBA project to call the
loading of this project and I call to execute the first Sub to start it as
follow (I modified the code here to make it easier to read so don't tell me
I made syntax mistake or something like this) :

=========================
If DragonFlyCharge = False Then 'Project not loaded yet
ThisApplication.VBAProjects.Open("G:\Dessin\Inventor\DragonFly\VBA\DragonFly.ivb")
NombreDeProjets = ThisApplication.VBAProjects.Count
Set MonProjet = ThisApplication.VBAProjects.Item(NombreDeProjets)
End If

MonProjet.InventorVBAComponents.Item("DragonFlyStart").InventorVBAMembers.Item("DragonFly").Execute
==========================

It works just fine as long as I don't lock the project with a password. As
soon as I lock it, the code stops at the last line which is suppose to
execute the Sub "DragonFly".
0 Likes
Message 11 of 14

Anonymous
Not applicable
Yes. As I said, the code stops only when I lock the project... Everything works fine as long as the project is unlocked. Autodesk already saw something similar?
0 Likes
Message 12 of 14

Anonymous
Not applicable
i just tried one in 2008 sp1 and had no problem with running the sub. i have
to believe that it has something to do with where your sub is declared or
how you have it declared. perhaps if you post the first line of the sub and
the exact name of the module where the sub resides? what version of iv as
well and any sp's.

joe ...

wrote in message news:[email protected]...
Yes. As I said, the code stops only when I lock the project... Everything
works fine as long as the project is unlocked. Autodesk already saw
something similar?
0 Likes
Message 13 of 14

Anonymous
Not applicable
Using IV 11 Pro SP3, here is the code for my module "Module_ChargeDragonFly":
(My command button calls directly "ChargeDragonFly")
===============================================
Option Explicit
'Cette Sub permet de charger le projet DragonFly s'il n'est pas déjà chargé
'
'

Public Sub ChargeDragonFly()

Dim NombreDeProjets As Integer
Dim DragonFlyCharge As Boolean
Dim MesProjets As InventorVBAProjects
Dim MonProjet As InventorVBAProject

NombreDeProjets = ThisApplication.VBAProjects.Count

DragonFlyCharge = False

Set MesProjets = ThisApplication.VBAProjects

For Each MonProjet In MesProjets
If Right(MonProjet.VBProject.FileName, 13) = "DragonFly.ivb" Then
DragonFlyCharge = True
Exit For
End If
Next

If DragonFlyCharge = False Then
'Spécifier le nom du .ivb à charger
ThisApplication.VBAProjects.Open ("G:\Dessin\Inventor\DragonFly\VBA\DragonFly.ivb")
NombreDeProjets = ThisApplication.VBAProjects.Count
Set MonProjet = ThisApplication.VBAProjects.Item(NombreDeProjets)
End If

'Nom du module 'Nom de la public sub
MonProjet.InventorVBAComponents.Item("DragonFlyStart").InventorVBAMembers.Item("DragonFly").Execute

End Sub
===============================================

Thanks!
0 Likes
Message 14 of 14

Anonymous
Not applicable
did you install or uninstall any office products since you installed
inventor?

if so, i would suggest re-installing inventor.

joe ...

wrote in message news:[email protected]...
Using IV 11 Pro SP3, here is the code for my module
"Module_ChargeDragonFly":
(My command button calls directly "ChargeDragonFly")
===============================================
Option Explicit
'Cette Sub permet de charger le projet DragonFly s'il n'est pas déjà chargé
'
'

Public Sub ChargeDragonFly()

Dim NombreDeProjets As Integer
Dim DragonFlyCharge As Boolean
Dim MesProjets As InventorVBAProjects
Dim MonProjet As InventorVBAProject

NombreDeProjets = ThisApplication.VBAProjects.Count

DragonFlyCharge = False

Set MesProjets = ThisApplication.VBAProjects

For Each MonProjet In MesProjets
If Right(MonProjet.VBProject.FileName, 13) = "DragonFly.ivb" Then
DragonFlyCharge = True
Exit For
End If
Next

If DragonFlyCharge = False Then
'Spécifier le nom du .ivb à charger
ThisApplication.VBAProjects.Open
("G:\Dessin\Inventor\DragonFly\VBA\DragonFly.ivb")
NombreDeProjets = ThisApplication.VBAProjects.Count
Set MonProjet = ThisApplication.VBAProjects.Item(NombreDeProjets)
End If

'Nom du module
'Nom de la public sub
MonProjet.InventorVBAComponents.Item("DragonFlyStart").InventorVBAMembers.Item("DragonFly").Execute

End Sub
===============================================

Thanks!
0 Likes