I am having an issue updating the Default.ivb file to add new VBA macros. I use the auto run code in the default.ivb file to run our macros. When I create a new macro I just add the new macro info to default.ivb and everyone can then add the button. It has worked great for almost 10 years.
In the past when I did edit the default.ivb file I had to make sure I was the first one to grab a license in the morning before anyone used a macro or the default.ivb file would be read only. Now when I edit the default.ivb file and try to save it I get the attached error. I don't ever remember getting this error before. Any ideas why I can't edit the file and am getting this message?
Solved! Go to Solution.
Solved by rob.j.ross. Go to Solution.
All i can say is, check if
1. the file isn't read only
2. anyone (but you) has Inventor running
Hi,
I've seen that error once, I think. And if I remember right I just had to restart Windows and it disappeared - maybe something locked it.
By the way, if you are using Inventor 2014 then Auto macros will not run:
Cheers,
Thanks Adam. Restarting didn't fix it. It acts like it is read-only but it doesn't show as Read-Only. Usually when Default.ivb is read only it is indicated in the name like ApplicationProject(Default.ivb - Read Only)
What I meant by auto run was using the following code in the Default.ivb file. Auto run is the wrong name for it but the below still works with 2014.
'Main function Public Sub RunCustomProgram(Filename As String, ProjectName As String, ModuleName As String, FunctionName As String) Dim oIvVBAProjects As Inventor.InventorVBAProjects Set oIvVBAProjects = ThisApplication.VBAProjects Dim j As Integer Dim i As Integer Dim oIvVBAComps As InventorVBAComponents Dim oIvVBAMembers As InventorVBAMembers Dim oIvVBAMember As InventorVBAMember Dim dd As Object For i = 1 To ThisApplication.VBAProjects.Count Dim cc As Object Set cc = ThisApplication.VBAProjects.Item(i) If cc.Name = ProjectName Then Exit For End If Next
...
Hi,
And where do you call RunCustomProgram from? From an addin?
Also, where is the VBA file? Is it on your machine and you share it with others or on a server?
The machine storing the file should be restarted - as a test.
You could also try to make a copy of the file in File Explorer and then try to delete it to see if you really have full access to it - not just read.
Cheers,
Adam,
The RunCustomProgram code is called from the Default.ivb file.
This code was posted by someone on this forum a long time ago(couldn't find the post) and I have been using it for about 8 years. It makes adding and distributing VBA macros very easy and works in Inventor 2014. The Default.ivb file is on the network so I can point everyone's Application Options to it.
The issue was that someone else was locking the Default.ivb file through use of a macro even though it wasn't showing as read-only as it typically does. I solved it by having our IT department create a batch file that basically kicks everyone out of the Default.ivb file. You can also do this manually through Windows MMC by Closing Open Files. When everyone is out, I can now edit the file. Thanks for the input.
mr_ensing, thanks for the link. I will check it out.
Keeping the file in vault is a good idea. Thanks for the suggestion. Your Application Options point to the local copy of the Default.ivb?