Unable to Copy Add-in To Library Error

G

Guest

Hello,
I have a Workbooks_Open macro that uses this code to look for a specific add
in.

Dim AddCount, AddNo As Integer
Dim vPath As String
AddCount = Application.AddIns.Count
If AddCount > 0 Then
For AddNo = 1 To AddCount
If AddIns(AddNo).Name = "ERAC_TranslateAddIn.xla" Then
vPath = AddIns(AddNo).Path
Dim ChkFile$
ChkFile$ = Dir(vPath & "\ERAC_TranslateAddIn.xla")
If ChkFile = "ERAC_TranslateAddIn.xla" Then
AddIns("Erac_Translateaddin").Installed = True
Else
vPath = ""
End If
End If
Next AddNo
End If

If it is not found it uses this to add the add in.

AddIns.Add Filename:= _
"\\fscorp00\Corp_Public\Groups\Corporate
Accounting\AutoMonarch\Excel_Add_Ins\ERAC_TranslateAddIn.xla"

Some users get a run time error "Unable to copy add-in to library". Any idea
why that happens or what I can do about it? Is there anything special about
copying add ins?
Thanks,
John
 
S

sjoo.kwak

Hello,

I've tested your code and meet an run-time error at [
AddIns("Erac_Translateaddin").Installed = True ]
Instead of that, How about using [ AddIns(AddNo).Installed = True ] ?

After testing, I have a success!!!!!


Best regards

(e-mail address removed)
 
J

Jim Cone

John,
Is the file path identical for all users?
Maybe, some users changed where their files are stored?
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"John Hutcins"
<[email protected]>
wrote in message
Hello,
I have a Workbooks_Open macro that uses this code to look for a specific add
in.

Dim AddCount, AddNo As Integer
Dim vPath As String
AddCount = Application.AddIns.Count
If AddCount > 0 Then
For AddNo = 1 To AddCount
If AddIns(AddNo).Name = "ERAC_TranslateAddIn.xla" Then
vPath = AddIns(AddNo).Path
Dim ChkFile$
ChkFile$ = Dir(vPath & "\ERAC_TranslateAddIn.xla")
If ChkFile = "ERAC_TranslateAddIn.xla" Then
AddIns("Erac_Translateaddin").Installed = True
Else
vPath = ""
End If
End If
Next AddNo
End If

If it is not found it uses this to add the add in.

AddIns.Add Filename:= _
"\\fscorp00\Corp_Public\Groups\Corporate
Accounting\AutoMonarch\Excel_Add_Ins\ERAC_TranslateAddIn.xla"

Some users get a run time error "Unable to copy add-in to library". Any idea
why that happens or what I can do about it? Is there anything special about
copying add ins?
Thanks,
John
 
T

Tim Williams

Is it possible that not all users have write access to the Library directory?

Tim
 
G

Guest

Thanks to everyone who has replied. I figured out what the immediate problem
is. Now I am trying to figure out if I can fix it through the program.

When this exicutes
AddIns.Add Filename:= _
"\\fscorp00\Corp_Public\Groups\Corporate
Accounting\AutoMonarch\Excel_Add_Ins\ERAC_TranslateAddIn.xla"
The user is asked if they want to copy the add in to their add in folder.
Our instructions are to answer "Yes". If a user answers "No" they set a
reference to the add in on our shared drive and then either other users get
an error message when they try to copy it because it is in use or Excel seems
to be unable to find and run the macro code in the addin from the shared
drive address. That may also be because someone has it open already.

My fix for insuring that each user gets an idividual copy is to use a file
scripting object to copy the file from our shared drive to a local drive only
accessible by that user such as "C:\temp" then use AddIns.Add on that file.

What I would also like to do is undo the addin already created that is
pointing to the shared drive file. If I do that through the Excel menu by
turning off he add in then using the Browse button to locate the local file
it resets fine. But, I can't seem to do the same thing via VBA code

I'm using
AddIns("Erac_Translateaddin").Installed = False
then
AddIns.Add Filename:="C:Temp\ERAC_TranslateAddIn.xla"
after the file scripting object copies the file there
then
AddIns("Erac_Translateaddin").Installed = True
This all runs but I still end up with the add in pointing to the old files
path. Am I getting it twice and need to look for more than one and use the
index number to refer to what I am turning on and off?

Thanks,
John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top