ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Unable to Copy Add-in To Library Error (https://www.excelbanter.com/excel-programming/359784-unable-copy-add-library-error.html)

John Hutcins

Unable to Copy Add-in To Library Error
 
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_Translat eAddIn.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

[email protected]

Unable to Copy Add-in To Library Error
 
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




Jim Cone

Unable to Copy Add-in To Library Error
 
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"

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_Translat eAddIn.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

Tim Williams

Unable to Copy Add-in To Library Error
 
Is it possible that not all users have write access to the Library directory?

Tim

"John Hutcins" 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_Translat eAddIn.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




John Hutcins

Unable to Copy Add-in To Library Error
 
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_Translat eAddIn.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

"Jim Cone" wrote:

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"

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_Translat eAddIn.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



All times are GMT +1. The time now is 08:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com